[protobuf] Problem with accent

2012-03-26 Thread Simon
Hi guys,

I have an annoying problem with some accent.
I build my proto-object, no problem, and when i want to read it the
browser, using .toString function, i have \303\240 instead of à,
\303\250 instead of è, etc...

So i'm wondering where can be the problem ?
Eclipse encode the files in UTF-8, Maven the same.

I just don't know where to look for :/

Thanks !

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Problem with accent

2012-03-26 Thread Evan Jones
On Mar 23, 2012, at 9:07 , Simon wrote:
 I have an annoying problem with some accent.
 I build my proto-object, no problem, and when i want to read it the
 browser, using .toString function, i have \303\240 instead of à,
 \303\250 instead of è, etc…

What do you mean i want to read it the browser using .toString function? Is 
this Java or C++ or something else? What does your message definition look like?

By default, protocol buffers encodes strings in UTF-8. These characters seem to 
be encoded correctly as UTF-8, so the sending side is doing the right thing, 
but the code that is reading them is not doing the correct decoding:

à = U+00E0

Escaped in hexadecimal this is: \xc3\xa0
Escaped in octal this is: \303\240


So you need to decode from UTF-8 to get the correct characters. Hope this helps,

Evan

--
http://evanjones.ca/

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.