tags:

views:

56

answers:

4

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")

A: 

You can use the function utf8_encode

codaddict
+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
+1  A: 

You can use either :

Pascal MARTIN
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