0

Hi guys i have a piece of html encoded text :请 -> 请 I tried using the following functions: HttpUtility.HtmlDecode/=WebUtility.HtmlDecode to decode it but it gives me a question mark. However when i try something like an online HTML decoder, I'm able to see the proper chinese character How can i choose the language for it to be outputted to?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
Travis Teo
  • 13
  • 2
  • 1
    This is an encoding issue – Cid Jan 09 '20 at 07:52
  • @Cid, What do you mean it's an encoding issue? I'm not very familiar with HTML encoding and would appreciate if you could give more details so i could look into it.. – Travis Teo Jan 09 '20 at 07:56
  • It may be correctly decoded. How are you displaying it ? – Cid Jan 09 '20 at 07:57
  • @Cid Ah, right. Then it's probably an encoding/font issue then. – Sweeper Jan 09 '20 at 07:57
  • @Sweeper, Hi actually it already has the ; at the end, i left it out on accident – Travis Teo Jan 09 '20 at 07:57
  • @Cid, I am merely capturing it as a string value and Writing to my console output. Could this be the reason why I am just seeing a question mark? – Travis Teo Jan 09 '20 at 07:59
  • @TravisTeo try `Console.OutputEncoding = System.Text.Encoding.UTF8;` and then, try again displaying in the console – Cid Jan 09 '20 at 08:02
  • 1
    Could be related [How to write Unicode characters to the console?](https://stackoverflow.com/questions/5750203/how-to-write-unicode-characters-to-the-console) – Cid Jan 09 '20 at 08:04
  • @Cid, Thanks for the prompt replies, I've tried UTF8 Encoding but it displays it as a question mark symbol within a box now – Travis Teo Jan 09 '20 at 08:05
  • @Cid, you're right, the link you have provided was insightful. Thanks for the help, if you would like i could mark your answer as the correct one. – Travis Teo Jan 09 '20 at 08:08
  • If this link solved your problem, better to mark this question as duplicate – Cid Jan 09 '20 at 08:09

0 Answers0