PDA

View Full Version : CLI charset issues



gsamsa
2008-07-27, 14:50
I've been working on some Objective-C code (iPhone stuff) to work with the CLI. Using 7.0.1, I was getting responses from the server, and decoding them into utf8 using a library call something like this:
decoded = [encoded stringByReplacingPercentEscapesUsingEncoding:NSUTF 8StringEncoding];

Seems pretty straightforward, and it was working.

Then I upgraded to 7.1, and accented characters are wrong. Looking at what's coming back from the server, I see that "Björk" is coming back as "Bj%C3%83%C2%B6rk". What'd I'd expect would be "Bj%C3%B6rk". I'm not a charset expert, but it appears to be some sort of double encoding. Or am I missing something?

I tried running 7.0.1 without uninstalling 7.1, and eventually reverted to 7.0.1, but the problem remains. I'm wondering if this could be some sort of MySQL issue...and I've done something that has left my system misconfigured.

Can anyone shed light on the issue? Bug, or am I just doing something wrong?

Thanks.

mike

cparker
2008-07-29, 12:50
Hi Mike

I dont fully understand the encoding stuff, so cant really help. However I'm wondering why you wouldnt expect to see a result like;

Bj%F6rk

(Encoded at http://www.xav.com/encode.pl)

Thanks, your answer may help my encoding problem :)

gsamsa
2008-07-29, 13:45
Well, that looks more like the Latin / iso-8859-1 encoding. If you look at, say, http://www.hypergurl.com/urlencode.html it'll show a UTF-8 encoding.

I figured out a workaround for my problem...I'm doing the same decoding I did, but then I'm treating the string as ISO Latin encoded and converting it to a UTF8 string. Make any sense? Not to me either. (But again, it seems like a double encoding to me).

My big problem at the moment is that I don't know if this workaround is only applicable to my system, or to every system. I'm pretty sure it wasn't necessary for me a week ago. But I uninstalled/reinstalled SqueezeCenter a couple times, wiped all my settings, etc., and the behavior persists.

I kinda halfway get this encoding stuff and haven't taken the time to dig in and understand it 100%. Still hoping someone who knows this stuff will have some useful feedback.