0

I want to return in the SQL table content in to a JSON format in C# as per http://www.percederberg.net/tools/text_converter.html, The input type is plaintext, ISO-Latin-1

Baden-Württemberg

and output type is JSON/Javascript/Java - String text

"Baden-W\u00FCrttemberg"

How could I do in C# .Net

Sanjeev S
  • 626
  • 1
  • 8
  • 27

1 Answers1

0

You could try this:

byte[] bytes = Encoding.Default.GetBytes(myString);
myString = Encoding.UTF8.GetString(bytes);

For reference: How can I transform string to UTF-8 in C#?

Community
  • 1
  • 1
Edgaras
  • 154
  • 9
  • Thanks for your replay. Unfortunately I get the output Baden-W�rttemberg – Sanjeev S Dec 31 '15 at 10:55
  • Try byte[] bytes = Encoding.UTF8.GetBytes(myString); It worked for me at least. Idea is to encode your string as UTF8 then you can easily decode it – Edgaras Dec 31 '15 at 11:16