How can I prevent user from typing other language?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
keynet
Posts: 18
Joined: Wed Jun 27, 2012 9:07 am

How can I prevent user from typing other language?

Post by keynet »

Hi.

Since I'm Korean, I modified irrlicht so that the program can get other language, not just English, using IME.

But in my program, especially the Login and Register UI, it needs to be constraint user's input: it should be only English, and space, special character(ex.@#$!@#... etc), Korean character, are not permitted.

I think there maybe two ways to do this: one is using some string functions and another is using some irrlicht functions.

Using check functions of wchar_t or std::wstring class, I maybe check whether the string or each character is English or not.
So I'm now individually trying to find solution using this technic.

But I don't know how to prevent this as Engine level.
Does anybody has similar problem like this?
Please teach me T.T. and thx in advance
From Seoul, South Korea
Mel
Competition winner
Posts: 2293
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: How can I prevent user from typing other language?

Post by Mel »

the simplest way is to use just chars and restrict them to the range 32-127 because those are the 8bit standard characters. After that, starts the extended ascii, which is diferent from a country to other, and beyond that, you need the wchar_t type and the unicode.

So, perhaps, you can still use wchar_t variables and check that none of the written characters is outside of the 32-127 range.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
keynet
Posts: 18
Joined: Wed Jun 27, 2012 9:07 am

Re: How can I prevent user from typing other language?

Post by keynet »

Oh.. so there is no way to prevent this as Engine level?

I mean, actually, I wanted to use some language-constraining function belonging to IGUIEditBox class...

Anyway, thanks a lot. I already solved this using isAlphabet() function for each wchat_t character
From Seoul, South Korea
Post Reply