PoorMansTSqlFormatter icon indicating copy to clipboard operation
PoorMansTSqlFormatter copied to clipboard

Notepad++ Encoding issue with foreign characters

Open blacktea-latte opened this issue 6 years ago • 3 comments

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!

blacktea-latte avatar Apr 05 '19 09:04 blacktea-latte

This looks like it might be the same issue as #160, but with a better description / reproduction instructions.

TaoK avatar Jul 28 '19 14:07 TaoK

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.

TaoK avatar Jul 28 '19 17:07 TaoK

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;

dofine avatar Aug 01 '19 12:08 dofine