Re: Filename Encoding Help

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well, happens.
Idea: if acceptable for the user, write at the top of the file some
info on the code page used for the file.
(the way xml (optionally) does, with <?xml version="1.0" encoding="blah"?>)
You can even add something user friendly, but also easy to parse
(For instance:
Required code page: 932
If this file is opened on a Windows with a mismatching system code page,
it's content might look corrupted, and is most likely inintelligible
)
This way, if you can parse the first line and get the code page.
You can then use that (and Encoding.GetEncoding) to conver to Unicode.
So you will be able to use a Japanese-encoded file even on a Korean
(Russian, Greek, English, etc.) system, even if it looks bad in Notepad.


Would have never crossed my mind. Simple solution.
Thanks for that. :)
.



Relevant Pages