anon
anon

Reputation:

Convert any type of encoded input string to UTF-8 with standard .Net functionality / BCL

In one of our applications users can upload plaintext files into the system and later on these files are read and worked on. Unfortunately users have a wide variety of encodings for these files (Ansi, UTF-*, Unicode, etc etc) but in the end we need the content as UTF-8 strings.

Is there any way to take any input string (encoding-wise), identifying its encoding and convert to UTF-8 with .Net standard functionality?

Upvotes: 1

Views: 170

Answers (1)

mathieu
mathieu

Reputation: 31202

Please, have a read at the following article : http://www.joelonsoftware.com/articles/Unicode.html

tl;dr; version : It does not make sense to have a string without knowing what encoding it uses.

Upvotes: 1

Related Questions