Lua and utf8

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
gring
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Tue Mar 18, 2008 09:26
Location: Sweden

Lua and utf8

Postby gring » Wed Oct 08, 2008 20:51

Hi,

Stumpled upon some problems with the way CEGUI handles string conversion to lua, which causes us some issues in our project. But the real problem is ofcourse that Lua doesn't handle unicode.

Today when you get a text from let's say an editbox or any widget. You get it as a utf8 encoded string. Then when you set this text to another control it's assumed to be a std::string non utf8 encoded.

So if you enter some characters in the editbox that will become encoded in utf8. Then you get double characters in the new control.

I don't have a straight forward solution to this. Cause of projects being unicode and non unicode. Still it would be much more consistant to treat all strings to and from lua as utf8 and have a special assign method for non utf8 strings (i.e. std::string).
The drawback with this is it's not so good for non-unicode projects to make a solution, where they would have to use some special method to assign strings, which would be unfortunate. I don't mind to treat all std::strings as unicode, are there any better ways around this?

/Gring

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Oct 09, 2008 08:10

Hi,

Thanks for drawing attention to this - I can see how it could be a pain! Having said this, I also do not have an immediate solution that would be ideal.

I'll continue to think about this, maybe look some things up, and perhaps come up with something over the weekend. In the mean time, if any one has any good ideas, please feel free to submit them here :)

CE.


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests