0

I have a string like that "tỏa" and how to I get the character "ỏ" as a string? When I print string[1], it displayed � not "ỏ".

Thank in advance. I hope you will help me to solve that problem.

  • 4
    You need to spend a ***lot*** of time learning all about encoding and character sets, what they are and how they work; and then study your compiler's and operating system's documentation. This is a surprisingly complicated subject. Good luck. – Sam Varshavchik Feb 19 '20 at 01:45
  • 2
    The encoding of the output device needs to match the encoding you are printing - which is likely the encoding your text editor is set to when you wrote your code. – Galik Feb 19 '20 at 01:48
  • 1
    use a Unicode library like ICU to get the next codepoint. Unicode is too complex to handle it yourself even if you learn how to decode UTF-8. "ỏ" can be precomposed (U+1ECF) or decomposed (U+006F U+0309). And there are many characters that are composed of multiple codepoints like flags (, will act and look like one character) or emojis ‍‍‍‍‍ – phuclv Feb 19 '20 at 02:10
  • 1
    This is your third question about this. Are the answers posted to [your first question](https://stackoverflow.com/questions/60277644/get-latin-character-in-c) not clear? – Blastfurnace Feb 19 '20 at 02:27
  • You have to know which code page is used by your application and by the peripherical and either use the same one or do a conversion. Also, you need to be sure that the font you use contains characters you want to display. An editor like Notepad++ could be very useful to check encoding of a file and do conversions for testing purpose. – Phil1970 Feb 19 '20 at 03:54

1 Answers1

1

Have a look at: http://www.cplusplus.com/forum/general/77234/ it nicely explains how to do it.

BitFreak
  • 406
  • 3
  • 10