Reputation: 2583
I am trying to find a good alternative to std::string
in games. wstring
doesn't work properly in Android. So far I just use ushort[]
with 0-65535
range(2 bytes per character) and it seems to work fine for 11 languages as bitmap fonts but moving forward I'd like to get a better implementation.
u8"xxxyyy"
literal notations aren't supported in VC++ compiler yet, what other options do I have?
Upvotes: 2
Views: 1530
Reputation: 140806
The path of least resistance is probably to just go ahead and put UTF-8 in std::string
objects. You will have to write UTF-8 literals using manually-encoded backslash escapes for anything not in the ASCII range, and you won't be able to use locale
, but in my experience locale
is useless anyway. I can't personally vouch for its helpfulness, and it's inconveniently huge, but you may find that the ICU libraries have routines geared to this strategy.
Upvotes: 2