Question:
When I use CkStringArray's LoadFile or LoadFromFile2 methods to load the content of a text file where the path contains Danish, Swedish and most likely characters from other languages, it fails with the following:
ChilkatLog:
LoadFromFile2:
DllDate: Dec 18 2012
UnlockPrefix: XXXXXXXXXXXXXX
Username: XXXXXXXXXXXXX
Architecture: Little Endian; 32-bit
Language: Visual C++ 11.0
VerboseLogging: 0
loadFromFile2:
loadFileAnsi:
openForReadWin32:
Failed to open file (2)
localFilePath: D:\test\llebrd\test.txt
currentWorkingDirectory: D:\Projects\TestProject
osErrorInfo: The system cannot find the path specified.
localWindowsFilePath: D:\test\llebrd\test.txt
--openForReadWin32
--loadFileAnsi
--loadFromFile2
--LoadFromFile2
--ChilkatLog
The path in question contains the letter 'ø' as in øllebrød: D:\test\øllebrød\test.txt. If I use CkString's LoadFile method it appears to work fine.
I tested but did not find a problem.
Maybe this is the problem: When a "const char " is passed to a Chilkat method, the default interpretation is that the bytes are characters represented in the ANSI encoding. If you are passing a "const char " that contains utf-8 encoded, bytes, you must first tell the object instance that it should interpret incoming "const char *" args as utf-8. You would do this by setting the "Utf8" property (which is common to all Chilkat C++ classes) to true. For example:
CkString strPath; // Passing ANSI here because it's a string literal. strPath.append("D:/test/øllebrød/test.txt");
CkStringArray sa; sa.put_Utf8(true); // Passing the utf-8 representation of the path to LoadFromFile: bool success = sa.LoadFromFile(strPath.getUtf8());