Results 1 to 4 of 4

Thread: String encoding

  1. #1
    die_gestalt is offline Registered User
    Name: Hanz Fünzinger
    Organization: self-employed
    Project: Various projects, trying to learn Ice
    Join Date
    Mar 2008
    Posts
    25

    String encoding

    Hello,

    I made a C++ server sending strings to a C# client.
    The string contains characters like "é". Finally, the client receives an Unmarshall exception. Obviously, the source file is encoded in utf8.

    I made a test with wstring :

    Code:
    std::wstring ws = L"é";
    std::string myString = IceUtil::wstringToString(ws);
    and now it works.

    I'm using ice 3.3.0, and I read on previously threads that those kinds of bug have been corrected. So I don't understand why I can't directly use std::string, when my file is encoding in utf8.

    Thanks for your help.

  2. #2
    die_gestalt is offline Registered User
    Name: Hanz Fünzinger
    Organization: self-employed
    Project: Various projects, trying to learn Ice
    Join Date
    Mar 2008
    Posts
    25
    Has somebody a piece of answer ?
    This is a very important issue for us.

    Thanks.

  3. #3
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    It sounds like the string you are trying to send is not in UTF-8 format and therefore if you want to just use std::string you need to configure a string converter to convert it to UTF-8. See the manual for more information on string converters.

    I tried this out using the Ice/converter C++ demo and a C# server, using the string "Bonne journée". If I either just create the string in UTF-8 format ("Bonne journ\303\251e") or create it in non-UTF-8 ("Bonne journ\351e" which LATIN-1) and also configure a string converter then it works fine.

    However, if I just try to send the non-UTF-8 string without configuring a converter then the C# server throws a MarshalException because it receives a non-UTF-8 string.

  4. #4
    die_gestalt is offline Registered User
    Name: Hanz Fünzinger
    Organization: self-employed
    Project: Various projects, trying to learn Ice
    Join Date
    Mar 2008
    Posts
    25
    Ok, I have to use WindowsStringConverter while I'm working on windows. I didn't think it was mandatory.

    Now it works.

    Thank you for your help Dwayne !

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. String encoding bug with IceEJ 1.1.0
    By flattanzio in forum Patches
    Replies: 0
    Last Post: 05-14-2007, 08:49 AM
  2. Replies: 1
    Last Post: 09-16-2005, 03:01 AM
  3. Q on Data encoding
    By ChMeessen in forum Comments
    Replies: 3
    Last Post: 01-28-2005, 09:19 AM
  4. IceSSL encoding
    By nsns in forum Bug Reports
    Replies: 4
    Last Post: 01-26-2005, 04:03 AM
  5. problem in mapping string->string[] in C#
    By teayu in forum Help Center
    Replies: 2
    Last Post: 10-26-2004, 11:12 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
  •