PoorMansTSqlFormatter
PoorMansTSqlFormatter copied to clipboard
Notepad++ Encoding issue with foreign characters
I have sql code that contains Chinese characters in UTF-8 encoding, and the formatter seemed to have problem identifying some of the characters. On the other hand, if the file was converted to ANSI before applying the formatter, things went just fine.
For example, here's a segment of the sql:
SUM(CASE
WHEN F2.NAME in ('测试(案例)')
THEN F2.BRN
ELSE 0
END) AS FLIGGY_BRN
But will get converted to the following:
SUM(CASE
WHEN F2.NAME IN ('测试(案例xEFxBC?)
THEN F2.BRN
ELSE 0
END) AS BRN,
Note that the chinese parenthesis and single quotation mark )' got converted into xEFxBC?
Looking forward to gaining some insights on this issue, thanks a lot! The plugin has been amazing!
This looks like it might be the same issue as #160, but with a better description / reproduction instructions.
Interestingly, the "mitigation" reported here ("Encode in ANSI") seems to work for issue #160, but I am unable to reproduce the issue reported here with Chinese characters... Any help reproducing would be very welcome.
Encode in ANSI works for me when writing Chinese characters. The problem doesn't always occur. It seems that once I have chosen ANSI encoding, converting it back to UTF-8 and re-format would work as expected.
Encoding with UTF-8:
select "你好" from T;