Help with UTF-8 (using API)!! Title needs to contain "\xe2\x80\x99", but it gets rejected by Native API? Need correct CURL command..

Skip to first unread message

Mark London

unread,
Aug 4, 2017, 12:31:49 PM8/4/17
to Dataverse Users Community
Hi - I don't know what I'm doing.   The following gets rejected.   How do I pass UTF-8 special characters?  I have very little knowledge about UTF-8 and 
how to deal with these issues.   Thanks!

        {
          "value": "\xe2\x80\x99",
          "typeClass": "primitive",
          "multiple": false,
          "typeName": "title"
        },

- Mark 

Pete Meyer

unread,
Aug 4, 2017, 4:35:32 PM8/4/17
to Dataverse Users Community

Hi Mark,

I'm able to get
`
            {
              "typeName": "title",
              "multiple": false,
              "typeClass": "primitive",
              "value": "test dataset, 6.7 Å resolution"
            }
`
to work (U+212B ; Angstrom symbol) with the native API and curl.  If you're using the python bindings, then the problem might be python2 text encodings; if things work with python3 (which I'm not sure of) that might be the simplest way around it.

Mark London

unread,
Aug 4, 2017, 6:19:02 PM8/4/17
to Dataverse Users Community
Pete - It took me a while to find the name of the encoding that you show below.   It's "unicode escape"!   Sigh.   So I have to add encode('unicode-escape') to all my python strings, in order to get them into the proper format.   A whole day wasted on this!   At least I can now relax over the weekend, knowing the solution. Thanks! - Mark

On Friday, August 4, 2017 at 12:31:49 PM UTC-4, Mark London wrote:

Pete Meyer

unread,
Aug 7, 2017, 10:43:01 AM8/7/17
to Dataverse Users Community
Hi Mark,

Glad you got it working - problems non-ASCII encodings in python2 generally turn into a time sink for me as well.

Best,
Pete
Reply all
Reply to author
Forward
0 new messages