c# - Windows service and default code page/culture setting? -


I am writing a service that will read files from a directory, read the contents of the file and process the content < / P>

I am having problems with Swedish characters that are read from the file because they are translated into "garbage characters" after reading. Do anyone know whether the code page / culture setting is being used by the Service Control Manager, or maybe you use "best practices" to handle Swedish characters in the context of Windows service programming. Do you know about any article about?

Any help is appreciated. / P>

This is probably something that you read the file and how the file is encoded. For example if the file is encoded with UTF-8 and it needs to be read with your ASCII then special character will be garbage. For example:

 using  (var fileStream = new streamminder (@ "path to file", encoding. UTF8)) {Console.Write (fileStream.ReadToEnd ()); }  

You can change encoding.UTF8 to match the encoding used to create the file.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -