Topic
3 replies Latest Post - ‏2013-10-22T07:31:35Z by SteveHull
JesperLarsen
JesperLarsen
34 Posts
ACCEPTED ANSWER

Pinned topic REST: special characters

‏2013-10-21T11:55:52Z |

Hi

Im trying to use the REST api to create users. The usernames can be any valid UTF8-name, so when posting to the REST service (api/operators) i send this XML:

<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Operator>
    <Name>HôtelBravo</Name>
    <Password>delme20x</Password>
    <MasterOperator>false</MasterOperator>
    <CustomContent>true</CustomContent>
    <ShowOtherActions>true</ShowOtherActions>
    <LoginPermission>Unrestricted</LoginPermission>
    <UnmanagedAssetPrivilege>ShowAll</UnmanagedAssetPrivilege>
  </Operator>
</BESAPI>

The operator gets created, but the return from the post says:

<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
<Operator Resource=http://xxx.xxx.xxx.xxx:52311/api/operator/H%c3%83%c2%b4telBravo">
<Name>HôtelBravo</Name>
<LastLoginTime>Thu, 01 Jan 1970 00:00:01 +0000</LastLoginTime>
<MasterOperator>false</MasterOperator>
<CustomContent>true</CustomContent>
<ShowOtherActions>true</ShowOtherActions>
<LoginPermission>Unrestricted</LoginPermission>
<UnmanagedAssetPrivilege>ShowAll</UnmanagedAssetPrivilege>
</Operator>
</BESAPI>

Now, looking at the raw bytes, when i send the ô, it is encoded as C3B4 as i would expect it to be with UTF-8, but then returned from the server (even though it says UTF-8 in the header) it returns the bytes C383 C2B4.

And when looking in the Management console, i can see that the newly created operator is named HôtX_delme20x and not HôtelBravo.

I can make the ô happen by converting the UTF-8 version of ô into ANSI.... Can someone confirm that the Name-parameter (others?) is read as ANSI and not UTF-8?

Kind regards Jesper

  • SteveHull
    SteveHull
    2 Posts
    ACCEPTED ANSWER

    Re: REST: special characters

    ‏2013-10-22T06:44:40Z  in response to JesperLarsen

    IEM does not yet have full support for UTF-8, so you are limited to the ANSI codepage that the server is installed in for all fields, property results, etc.

    • JesperLarsen
      JesperLarsen
      34 Posts
      ACCEPTED ANSWER

      Re: REST: special characters

      ‏2013-10-22T06:50:02Z  in response to SteveHull

      Thanks Steve. Ill just make some encoding myself then.

      Suppose the proper answer from the webservice should have been "not supported codepage" if the XML explicitly states UTF-8. 

      /Jesper

       

      • SteveHull
        SteveHull
        2 Posts
        ACCEPTED ANSWER

        Re: REST: special characters

        ‏2013-10-22T07:31:35Z  in response to JesperLarsen

        Yeah, I think you're encountering a side effect of our future plans to add UTF-8 support.  If I'm recalling correctly, the REST API does support it, with future full support in mind, but the rest of the server and database's lack of support converts the request to ANSI when executed.

        Regards, Steve