InitializationData no Support Chinese Path
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
initData.properties->load("C:\\中国\config.client");
Throw const IceUtil::Exception
|
|
InitializationData no Support Chinese Path
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
initData.properties->load("C:\\中国\config.client");
Throw const IceUtil::Exception
Hello,
Welcome to our forums!
Please always include the Ice version, compiler version and operating system you're using when reporting an issue.
Assuming you're using the latest version of Ice (3.4.1), you should be able load your config file from a directory with non-ASCII characters.
You also have to be careful. One question which encoding you use for these narrow string literals; by default, Ice expects all narrow strings to be UTF-8.
This discussion on Stack Overflow suggests you're better off using only ASCII characters in narrow string literals.
Could you update your code and try the following:
Then, in case you still get an exception, you should catch and "print" this exception to get more details about the problem:Code:// UTF-16; also note the double \ before config.client wstring configFile = L"C:\\中国\\config.client"; initData.properties->load(IceUtil::wstringToString(configFile));
Best regards,Code:try { ... } catch(const IceUtil::Exception& e) { cerr << "Caught: " << e << endl; }
Bernard
Bernard Normier
ZeroC, Inc.
For my suggested code to work properly with Visual Studio:
You also need to save your source file with the proper encoding. In Visual Studio, goto File > Advanced Save Options... and select "Unicode (UTF-8 with signature) - Codepage 65001" as your Encoding.Code:wstring configFile = L"C:\\中国\\config.client";
Best regards,
Bernard
Bernard Normier
ZeroC, Inc.
There are currently 1 users browsing this thread. (0 members and 1 guests)