Search code examples
c#.netutf8-decode

C# utf8_decoding


Equivalent to utf8_decode in php

I have an string: "tópicos" I need convert to "tópicos"

How do this? Thanks,advanced.


Solution

  • You need to get the bytes that that string represents in its original encoding (Windows-1252), then read those bytes as UTF8:

    Encoding.UTF8.GetString(Encoding.GetEncoding(1252).GetBytes("tópicos" ))