U++ framework
Do not panic. Ask here before giving up.

Home » Community » U++ community news and announcements » Upp 2007.1beta released
Re: Upp 2007.1beta released [message #7756 is a reply to message #7750] Fri, 19 January 2007 14:53 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
mobilehunter wrote on Thu, 18 January 2007 19:49

For example i set the default charset for TheIDE is UTF-8.
Then i do some code editing, and put same japanese glyph.

What character code will TheIDE receive from the system, is it in Shift-JIS?
Because i think, when we do EnumFont, the AddFace will receive Shift-JIS code.



String FromSystemCharset(const String& src)
{
	WStringBuffer b(src.GetLength());
	int q = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, ~src, src.GetLength(), (WCHAR*)~b, src.GetLength());
	if(q <= 0)
		return src;
	b.SetCount(q);
	return WString(b).ToString();
}


So we are using Win32 API function to translate system specific text (which is most likely in Shift-JIS, but we do not exactly have to care) to UNICODE and then to String using default encoding. Unfortunately, as default default encoding is win1252, unicode characters were lost.

Quote:


What kind of process that TheIDE do to show it back to user at editor box?



Before being displayed by Win32 GDI, inverse process is used to convert String to UNICODE.

Quote:


Which code that do translation from user keystroke to displaying it to editor box?



If Win32 supports unicode (Win98 does not!), windows are create using CreateWindowW API function and then WM_CHAR message come with UNICODE characters.

BTW, can you please test that my theory about no need of altering U++ library and just setting default charset to UTF-8 is correct?

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon4.gif
Read Message
Read Message
Previous Topic: Upp 612-dev3 released
Next Topic: Upp 701-dev1 released
Goto Forum:
  


Current Time: Fri Jun 12 19:51:54 GMT+2 2026

Total time taken to generate the page: 0.00690 seconds