Hey, I'm using php 5 and need to communicate with another server that runs completely in unicode. I need to convert every string to unicode before sending it over. This seems like an easy task, but I haven't been able to find a way to do it yet. Is there a simple function that returns a unicode string? i.e. convert_to_unicode("the string i'm sending")
+1
A:
You can use the utf8_encode and utf8_decode functions. Also, you may need to go through Multibyte String to deal with specific encoding with those mb functions.
Sarfraz
2010-03-18 06:19:34
+1
A:
You can use either :
utf8_encode
/utf8_decode
- The
mb_*
Multibyte String functions ; in your case, seemb_convert_encoding
- iconv and the
iconv
function.
Pascal MARTIN
2010-03-18 06:23:02
A:
Ok, iconv worked. The trouble is that this is a windows server, so I had to do it in little-endian. UTF-16LE works. Here's the working code:
iconv("UTF-8", "UTF-16LE", "data to send")
Chris
2010-03-18 06:56:04