Notepad++ and wrong ANSII encoding
-
Hello everybody : I have the following C# code which converts an UTF8 W/O BOM into an Windows-1252 textfile:
string inputstring = File.ReadAllText(@"c:\tmp\stringa.txt"); var srcEncoding = Encoding.UTF8; var destEncoding = Encoding.GetEncoding(1252); var destBytes = Encoding.Convert(srcEncoding, destEncoding, srcEncoding.GetBytes(inputstring )); var destString = destEncoding.GetString(destBytes); File.WriteAllBytes(@"c:\tmp\output0.txt", destBytes); return destEncoding.ToString();When I open the output0 file into Windows notepad I can see the italian accent letters right, but if I open Notepad++ the ANSI codepage is Windows-1251 and not Windows-1252.
The original file is an UTF-8 file created with Notepad++ , and Windows is configured with the Italian codepage (1252) correctly.
-
may I ask which npp version (debug-info from ? menu) and windows version you use?
How did you configure Settings->Preferences->New Document->Encoding?Cheers
Claudia -
Hello, here the debug info:
Notepad++ v7.5 (32-bit)
Build time : Aug 15 2017 - 23:02:57
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 10 (64-bit)
Plugins : mimeTools.dll NppConverter.dll NppExport.dllThe O/S is Windows 10 Professional 64 bit Italian
The encoding of “New Document” is:
- UTF-8 and is enabled the sub-option “Apply to opened ANSI files”
Thank you
-
Hi @luciferqam86, @claudia-frank and All,
Is it better if you uncheck the Autodetect character encoding option, in Settings - Preferences… - MISC ?
Sometimes this auto-detection causes some problems, instead of avoiding them :-D
Best Regards,
guy038
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login