decode xml entity in JSON

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

decode xml entity in JSON

Robert Carpenter
Greetings all-

I think I rode the dumb bus to work today...this seems like something I used to know how to do.

I'm getting a JSON array from vimeo.com, one element of which is a string of the video "title".

The title of one of our videos contains the string "Caffè", which vimeo.com is returning as "Caff\u00e8".

Color me stupid, but I can't recall, or summon from the docs, the method to convert that back into a nice UTF-8 string with the "è" intact. I've tried various combinations of decode_xml and the like, no soap.

Can someone gently kick me in the right direction?

-robert-
#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
To switch to the DIGEST mode, E-mail to <[hidden email]>
To switch to the INDEX mode, E-mail to <[hidden email]>
Send administrative queries to  <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: decode xml entity in JSON

Kyle Jessup-2

On May 24, 2011, at 2:25 PM, Robert Carpenter wrote:

> Greetings all-
>
> I think I rode the dumb bus to work today...this seems like something I used to know how to do.
>
> I'm getting a JSON array from vimeo.com, one element of which is a string of the video "title".
>
> The title of one of our videos contains the string "Caffè", which vimeo.com is returning as "Caff\u00e8".
>
> Color me stupid, but I can't recall, or summon from the docs, the method to convert that back into a nice UTF-8 string with the "è" intact. I've tried various combinations of decode_xml and the like, no soap.
>
> Can someone gently kick me in the right direction?

It's not an xml entity, so decoding xml won't do it. It does, however, seem to correspond to a unicode escape sequence.
This works in Lasso 9:

'Caff\u00e8'->unescape

Giving:
Caffè

It might be the same in older Lasso versions, if that's what you're using.

-Kyle

> -robert-

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
To switch to the DIGEST mode, E-mail to <[hidden email]>
To switch to the INDEX mode, E-mail to <[hidden email]>
Send administrative queries to  <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: decode xml entity in JSON

Robert Carpenter
Precisely the kick I needed.

Does what I'm looking for on my L8.6 install. Thanks!

-robert-

On May 24, 2011, at 11:35 AM, Kyle Jessup wrote:

>
> On May 24, 2011, at 2:25 PM, Robert Carpenter wrote:
>
>> Greetings all-
>>
>> I think I rode the dumb bus to work today...this seems like something I used to know how to do.
>>
>> I'm getting a JSON array from vimeo.com, one element of which is a string of the video "title".
>>
>> The title of one of our videos contains the string "Caffè", which vimeo.com is returning as "Caff\u00e8".
>>
>> Color me stupid, but I can't recall, or summon from the docs, the method to convert that back into a nice UTF-8 string with the "è" intact. I've tried various combinations of decode_xml and the like, no soap.
>>
>> Can someone gently kick me in the right direction?
>
> It's not an xml entity, so decoding xml won't do it. It does, however, seem to correspond to a unicode escape sequence.
> This works in Lasso 9:
>
> 'Caff\u00e8'->unescape
>
> Giving:
> Caffè
>
> It might be the same in older Lasso versions, if that's what you're using.
>
> -Kyle
>
>> -robert-
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list <[hidden email]>.
> To unsubscribe, E-mail to: <[hidden email]>
> To switch to the DIGEST mode, E-mail to <[hidden email]>
> To switch to the INDEX mode, E-mail to <[hidden email]>
> Send administrative queries to  <[hidden email]>
>


#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
To switch to the DIGEST mode, E-mail to <[hidden email]>
To switch to the INDEX mode, E-mail to <[hidden email]>
Send administrative queries to  <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: decode xml entity in JSON

Robert Carpenter
In reply to this post by Kyle Jessup-2
Precisely the kick I needed.

Does what I'm looking for on my L8.6 install. Thanks!

-robert-

On May 24, 2011, at 11:35 AM, Kyle Jessup wrote:

>
> On May 24, 2011, at 2:25 PM, Robert Carpenter wrote:
>
>> Greetings all-
>>
>> I think I rode the dumb bus to work today...this seems like something I used to know how to do.
>>
>> I'm getting a JSON array from vimeo.com, one element of which is a string of the video "title".
>>
>> The title of one of our videos contains the string "Caffè", which vimeo.com is returning as "Caff\u00e8".
>>
>> Color me stupid, but I can't recall, or summon from the docs, the method to convert that back into a nice UTF-8 string with the "è" intact. I've tried various combinations of decode_xml and the like, no soap.
>>
>> Can someone gently kick me in the right direction?
>
> It's not an xml entity, so decoding xml won't do it. It does, however, seem to correspond to a unicode escape sequence.
> This works in Lasso 9:
>
> 'Caff\u00e8'->unescape
>
> Giving:
> Caffè
>
> It might be the same in older Lasso versions, if that's what you're using.
>
> -Kyle
>
>> -robert-
>
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <[hidden email]>.
> To unsubscribe, E-mail to: <[hidden email]>
> To switch to the DIGEST mode, E-mail to <[hidden email]>
> To switch to the INDEX mode, E-mail to <[hidden email]>
> Send administrative queries to  <[hidden email]>
>


#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
To switch to the DIGEST mode, E-mail to <[hidden email]>
To switch to the INDEX mode, E-mail to <[hidden email]>
Send administrative queries to  <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: decode xml entity in JSON

Göran Törnquist-3
In reply to this post by Kyle Jessup-2
Just note that the JSON spec states that it should already be returned
escaped, which is one of the the bugs I reported the other day.

/Göran

On 2011-05-24 20.35, Kyle Jessup wrote:

> On May 24, 2011, at 2:25 PM, Robert Carpenter wrote:
>
>> Greetings all-
>>
>> I think I rode the dumb bus to work today...this seems like something I used to know how to do.
>>
>> I'm getting a JSON array from vimeo.com, one element of which is a string of the video "title".
>>
>> The title of one of our videos contains the string "Caffè", which vimeo.com is returning as "Caff\u00e8".
>>
>> Color me stupid, but I can't recall, or summon from the docs, the method to convert that back into a nice UTF-8 string with the "è" intact. I've tried various combinations of decode_xml and the like, no soap.
>>
>> Can someone gently kick me in the right direction?
> It's not an xml entity, so decoding xml won't do it. It does, however, seem to correspond to a unicode escape sequence.
> This works in Lasso 9:
>
> 'Caff\u00e8'->unescape
>
> Giving:
> Caffè
>
> It might be the same in older Lasso versions, if that's what you're using.
>
> -Kyle
>
>> -robert-
> #############################################################
> This message is sent to you because you are subscribed to
>    the mailing list<[hidden email]>.
> To unsubscribe, E-mail to:<[hidden email]>
> To switch to the DIGEST mode, E-mail to<[hidden email]>
> To switch to the INDEX mode, E-mail to<[hidden email]>
> Send administrative queries to<[hidden email]>
>
>


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
To switch to the DIGEST mode, E-mail to <[hidden email]>
To switch to the INDEX mode, E-mail to <[hidden email]>
Send administrative queries to  <[hidden email]>