View Single Post
  #5  
Old June 15th 18, 06:25 AM posted to alt.comp.os.windows-10
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Reading an .ini file with Notepad using Windows 10

Nil wrote:
On 14 Jun 2018, malone wrote in
alt.comp.os.windows-10:

Can anyone explain this rather strange behaviour? And, even, could
anyone using Irfanview with Windows 10 have a quick look and see
whether you can read the .ini file opened with notepad?


I only have 32-bit Windows 10, but i_view32.ini is a perfectly normal
text file, although my text editor Notepad++ says that its character
encoding is "UCS2-LE BOM", which is some sort of Unicode that I'm not
familiar with. Windows Notepad still displays it just fine. Same story
on my 64-bit Windows 7 machine.

I wonder if your file is corrupt and has become cross-linked with a
binary file? What's the file size of your ini file? It should be about
20 - 25 K. If it isn't, something is wrong with it.


http://docs.notepad-plus-plus.org/in...Little_Endian:

"In UCS-2 Little Endian:

The header is the sequence FFFE, which represents the character
0xFEFF (BOM), with the Least Significant Byte, written FIRST.

Every valid Unicode character, with code-point = \xFFFF,
is coded with TWO bytes.

The FIRST byte stored is the Least Significant Byte of each
sequence of two bytes, so the three characters of the test file,
are stored : 41 00 , B0 00 , 19 20
"

Which suggests with a hex editor, you might see the BOM.

Or, it might not be there.

On an older OS and copy of Notepad, the BOM will become
visible as squares or black dots or some other representation.
Whereas Win10 Notepad/Wordpad might not show the BOM, because
it's "interpreting" those bytes, instead of displaying them.

This is why I dig out the copy of HxD, as it's an honest
display tool that just displays stuff. It will show the
FF FE or whatever.

*******

Once you see bytes like that, don't panic. You can't
"cure" the problem by simply deleting any BOM you find.
The damage in a sense, is already done.

In the UCS-2 LE case, text characters are stored as 16 bit
values. For an English speaker, typically the second byte
is always zero. The Windows Registry uses a representation
like that, in order to deal with localization in
other languages.

As long as one of the system text editors (Notepad or
Wordpad) can correctly input the BOM and message, by using
Save As, you should be able to re-encode the file to a
better choice.

Even with "Chinese looking letters", the file isn't dead
yet. But you need that BOM info to figure it out.

Paul
Ads