Jump to content
  • Advertisement
Sign in to follow this  
miggs

worrying about different languages

This topic is 2953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi,

im currently just capturing WM_CHAR (and some virtual keys for other stuff) for a ingame chat, and i was thinking about whether i need to care about different language layouts for different languages?

my guessing, is that the ascii table should be fine with america/australia and all european countries, so i can just set my database in the background to ascii and don't care. (I don't want to care about chinese/arab char.set)

or should i somehow stick to utf8?

Share this post


Link to post
Share on other sites
Advertisement
ASCII doesn't even cover English words like café or naïve so I think it would be wise to support Unicode in some way (even if it's just a form of future-proofing). "Extended" ASCII (anything outside regular 7-bit ASCII) is dependent on specific code pages and I find it to be generally more awkward to work with than UTF-8, though it would give you support for some accented characters.

WM_CHAR returns UTF-16 and handles keyboard scancode translation for you, so you don't need to worry about different layouts for that.

Share this post


Link to post
Share on other sites
i thought wm_char was returning ascii. in this case, with utf-16, do i need to convert to utf-8 bevore being able to write them? and do what can the directx/open gl engines process? (meaning the variable-type (char/w_char..))

Share this post


Link to post
Share on other sites
Quote:
Original post by miggs
i thought wm_char was returning ascii. in this case, with utf-16, do i need to convert to utf-8 bevore being able to write them? and do what can the directx/open gl engines process? (meaning the variable-type (char/w_char..))


Neither OpenGL or DirectX cares about rendering of character strings or their format, but there's a large number of various libraries built on top of them that can do it . So basically your question depends on which higher-level graphics engine you're planning to use.

If you're going to make your own text rendering functions, I'd suggest you to simply store all your in-game text as std::wstrings, which internally stores characters as wchar_t unicode values. These unicode values can usually be passed directly to font backends like FreeType.

If you get all user text input through something like WM_CHAR, then you can just write the unicode values directly to your std::wstrings. Which in turn can be rendered directly to your screen (or whatever).

In other words you don't have to worry about which crazy characters the user is inputting (as long as they're in a "normal" european left-to-right reading language... If that's not the case you need to deal with other reading orders ofc, but unless you're doing a complete multi-localization of your game I wouldn't worry about it).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!