|
Posted by Steve Kass on 10/02/54 11:56
Meaningful Chinese files are likely to have some newlines that contain
0x00 bytes.
I removed the BOM from
空山不見人,
返景入深林,
但聞人語響。
復照青苔上。
But perhaps because of the 0x00's remaining in the newlines,
Notepad again took over. However, it this case, notepad displayed
garbage:
zzq\
N媺篘
詮ofeQ駇梘
FO^€篘瀶?0
gqR椩?N0
SK
Erland Sommarskog wrote:
> (mollyf@hotmail.com) writes:
>
>>Thanks Steve and Erland. That was definitely what was going on. I
>>know my coworker uses Textpad and I know he generated the scripts
>>through Mgmt Studio and then went back and made some changes in Textpad
>>(that's what I had done myself with both Textpad and Notepad on my own
>>machine and realized that something was going on whenever the file was
>>edited).
>>
>>Of course I'm wondering why this wasn't an issue in 2000 but now it's
>>an issue in 2005.
>
>
> I guess it's more an issue of the tools, not the SQL Server version as
> such.
>
> The default format for saving in Mgmt Studio is Unicode, while the default
> in Query Analyzer is ANSI I think. And with 8-bit chars you never run into
> these sort of problems.
>
> SQL Server Management Studio on the other hand saves in Unicode by default.
> I have not experienced that Textpad thrashes the BOM, but then again I don't
> use Unicode files in Textpad much. (Textpad only supports Unicode if chars
> are in the ANSI set, so it's kind of useless.)
>
> As for what happens when you open a BOM-less file, it appears that Notepad
> and Textpad plays a guessing game and says "every second byte is NULL, it
> must be Unicode". Guess what happens if there is some Chinese or Russian
> text, so that not every second byte is 00 anymore.
>
> Mgmt Studio refuses to open the file as soon there is a NUL character. But
> guess what happens if the file has only Chinese text. The file will open,
> but you will see something else.
>
> Or you can do like Query Analyzer, which opened my BOM-less file as is.
> That is, I see text like "S E L E C T "
>
Navigation:
[Reply to this message]
|