Character with encoding UTF8 has no equivalent in WIN1252

后端 未结 10 1019
挽巷
挽巷 2020-12-29 02:41

I am getting the following exception:

Caused by: org.postgresql.util.PSQLException: ERROR: character 0xefbfbd of encoding \"UTF8\" has no equivalent in \"WIN         


        
10条回答
  •  天涯浪人
    2020-12-29 02:56

    That looks like the byte sequence 0xBD, 0xBF, 0xEF as a little-endian integer. This is the UTF8-encoded form of the Unicode byte-order-mark (BOM) character 0xFEFF.

    I'm not sure what Postgre's normal behaviour is, but the BOM is normally used only for encoding detection at the beginning of an input stream, and is usually not returned as part of the result.

    In any case, your exception is due to this code point not having a mapping in the Win1252 code page. This will occur with most other non-Latin characters too, such as those used in Asian scripts.

    Can you change the database encoding to be UTF8 instead of 1252? This will allow your columns to contain almost any character.

提交回复
热议问题