Results 1 to 3 of 3

Thread: InitializationData no Support Chinese Path

  1. #1
    wang shuqiang is offline Registered User
    Name: wang shuqiang
    Organization: hylanda
    Project: SAAS
    Join Date
    Feb 2011
    Posts
    4

    InitializationData no Support Chinese Path

    InitializationData no Support Chinese Path

    Ice::InitializationData initData;
    initData.properties = Ice::createProperties();

    initData.properties->load("C:\\中国\config.client");

    Throw const IceUtil::Exception

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    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:

    Code:
    // UTF-16; also note the double \ before config.client
    wstring configFile = L"C:\\中国\\config.client"; 
    
    initData.properties->load(IceUtil::wstringToString(configFile));
    Then, in case you still get an exception, you should catch and "print" this exception to get more details about the problem:

    Code:
    try
    {
       ...
    }
    catch(const IceUtil::Exception& e)
    {
          cerr << "Caught: " << e << endl;
    }
    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    For my suggested code to work properly with Visual Studio:

    Code:
    wstring configFile = L"C:\\中国\\config.client";
    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.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ice do not support Chinese characters
    By IvanFly in forum Bug Reports
    Replies: 1
    Last Post: 06-03-2010, 02:12 PM
  2. Replies: 0
    Last Post: 04-09-2009, 05:50 AM
  3. Replies: 3
    Last Post: 10-24-2008, 09:06 AM
  4. Help, does IcePatch support Chinese directory?
    By youyou in forum Help Center
    Replies: 2
    Last Post: 12-12-2004, 09:00 PM
  5. Slice Path
    By Jennie in forum Help Center
    Replies: 2
    Last Post: 11-18-2004, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •