tags:

views:

77

answers:

4

Hi,

I am trying to insert characters like ä, á, ó, í, â, etc in message body of Amazon SQS. But these characters get converted to some other characters in SQS (e.g. ä). Is there a way to solve this problem.

Thanks

A: 

try utf8_encode

streetparade
tried that unsuccessfully. Thanks
kobra
A: 

This is likely due to a character encoding issue in your code. A highly recommended article about this topic is Joel's The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!).

It looks like your characters are being UTF-8 encoded somewhere and the corresponding UTF-8 decode operation is not being performed as you expect.

Greg Hewgill
I don't think so, because when I echo the message string it looks alright. The characters change only when it goes in AmazonSQS. Thanks
kobra
When you `echo` the data to an HTML page, your *browser* is probably decoding the UTF-8 encoded data and displaying the data properly as you expect. When working with encoded data (as is the norm these days), there are always a lot of layers of translation going on and it usually requires some research to find out what's really going on.
Greg Hewgill
A: 

Hi,

Thanks for the responses. I think the best way to over-come this problem is to store the message body in AmazonSQS in HTML-ENTITIES format. So before storing the message I encode it in HTML_ENTITIES format using php method mb_convert_encoding(string $str, string $to_encoding [,mixed $from_encoding]).

If anyone has a better solution please feel free to add your comments.

Thanks

kobra
A: 

I saw that this was solved at onlinemq but still exist in SQS

Hans Eraas