Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » how to convert unicode to String
how to convert unicode to String [message #49609] Tue, 13 March 2018 03:34 Go to next message
akebee is currently offline  akebee
Messages: 90
Registered: August 2011
Location: China
Member
such as

"nickname":"\u6728\u5076"

how to convert "\u6728\u5076" to "木偶" in U++
Re: how to convert unicode to String [message #49611 is a reply to message #49609] Tue, 13 March 2018 14:03 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
ToCharset()

Example:
const String l = ToCharset(CHARSET_UTF8, s.GetLine(), CHARSET_WIN1251);


Regards,
Novo
Re: how to convert unicode to String [message #49612 is a reply to message #49609] Wed, 14 March 2018 09:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
akebee wrote on Tue, 13 March 2018 03:34
such as

"nickname":"\u6728\u5076"

how to convert "\u6728\u5076" to "木偶" in U++


Depends on where "\u6728\u5076" comes from.... Usually you cannot use that literal with compiler directly.

Anyway, to get such string in U++, you can try:

WString s;
s.Cat(0x6728);
s.Cat(0x5076);

then maybe

String utf8 = s.ToString();
Re: how to convert unicode to String [message #49613 is a reply to message #49612] Wed, 14 March 2018 09:42 Go to previous messageGo to next message
akebee is currently offline  akebee
Messages: 90
Registered: August 2011
Location: China
Member
Thanks a lot. Smile
Re: how to convert unicode to String [message #49614 is a reply to message #49611] Wed, 14 March 2018 09:53 Go to previous message
akebee is currently offline  akebee
Messages: 90
Registered: August 2011
Location: China
Member
index.php?t=getfile&id=5531&private=0

	s = LoadFile("C:\\text.txt");
	const String l = ToCharset(CHARSET_UTF8, s, CHARSET_WIN1251);	
	LOG(s);


it seemed not work
Previous Topic: How to close the websocket connection
Next Topic: Curious problem wth Vector
Goto Forum:
  


Current Time: Fri Apr 19 17:50:04 CEST 2024

Total time taken to generate the page: 0.04466 seconds