esolliday / libkml

Automatically exported from code.google.com/p/libkml
Other
0 stars 0 forks source link

Unicode support on Windows #172

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Craft a UTF8 version of the path to the attached file and pass it to 
kmlbase::File::ReadFileToString() (inside a std::string).
2. Function fails to read the contents.

What is the expected output? What do you see instead?
The function fails. I expect it to work; it does in OSX. The problem seems to 
be that on Windows, UTF8 doesn't work with std::ifstream. If I craft the path 
as a UTF16, the std::ifstream works though. The problem is that you can't store 
UTF16 in a std::string. 

I think adding a ReadFileToString that takes a std::wstring would solve the 
problem.

What version of the product are you using? On what operating system?
1.2.0 on Windows 7 64-bit.

Original issue reported on code.google.com by ajpatter...@gmail.com on 11 Nov 2011 at 9:43

Attachments:

GoogleCodeExporter commented 8 years ago
This is also a problem if your file contains UTF8 file names / paths (e.g., the 
path to a image for a ground overlay).

Of course, the fix suggested would mean all functions that might take the 
result of ReadFileToString would also need std::wstring versions.

If you wanted to support UTF8 why wasn't wstring used in the first place?

Original comment by daniel.c...@gmail.com on 21 Jan 2015 at 10:38