majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Support for UTF-8 wchar_t #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am gonna use the library in my next project but need UTF-8 support. Is it
already possible to get UTF-8 content from the Nodes content variable?
So far I see no way to supply a new Read(const YAML::Node& node,
std::wstring& str) as I do not know how to get UTF-8 content from the node.

Original issue reported on code.google.com by phil.kur...@gmail.com on 23 Oct 2008 at 8:33

GoogleCodeExporter commented 9 years ago
My unicode knowledge is pretty shaky. What exactly are you looking for? The 
input is
just read character by character with an std::istream object - will this give 
you
what you want, or is a different type of parsing required? Or are you 
essentially
looking for a way to convert an std::string to an std::wstring?

Original comment by jbe...@gmail.com on 20 Nov 2008 at 3:56

GoogleCodeExporter commented 9 years ago
I understand. So I just would have to take the std::string and treat it as 
UTF-8. I
will try with an example. Maybe you can close this bug then :)

Original comment by phil.kur...@gmail.com on 20 Nov 2008 at 7:03

GoogleCodeExporter commented 9 years ago
OK. Let me know if it works.

Original comment by jbe...@gmail.com on 20 Nov 2008 at 7:03

GoogleCodeExporter commented 9 years ago
I added some extra functionality for reading into wide character arrays which 
simply
uses mbstowcs to do the conversion. I could send you a patch file if you like 
however
it would also includes extra node reading capability for other data types such 
as
64-bits.

Nick.

Original comment by n.vaug...@gmail.com on 15 Apr 2009 at 8:49

GoogleCodeExporter commented 9 years ago
Sounds good! (I obviously haven't really worked at this feature at all, so I'm 
glad to receive any help.)

Original comment by jbe...@gmail.com on 15 Apr 2009 at 10:25

GoogleCodeExporter commented 9 years ago
Here you go! This basically adds support for reading into wide character 
strings and
also some other data types such as 64-bit numbers.

Original comment by n.vaug...@gmail.com on 16 Apr 2009 at 8:49

Attachments:

GoogleCodeExporter commented 9 years ago
(Finally) applied (a version of) this patch (just the std::wstring stuff). I'm 
not sure about things like reading hex  
yet, but I can at least close this issue now :)

Original comment by jbe...@gmail.com on 15 Jul 2009 at 8:49