Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I work whit Nusoap lib in php and send a requst to C# whit WSDL tech
now I need send a char UTF-8 of php file or database to C# .
I can send other encoding but can't send UTF-8

for examlpe in php coe : سلام
but in C# : سلاÙ
Updated 15-Jun-23 1:15am

Ha! The tricky part is: there is no such thing as "UTF-8 char". It's only in UTF-32 there is a one-to-one correspondence between characters and code words. You first need to understand the idea of Unicode and UTFs.

Unicode standard is just a correspondence between integer values, called "code points" and considered as abstract mathematical integers without concerns to their computer presentation, size, endianess, etc., and characters of most cultures, understood as cultural entities, abstracted from the glyph fonts and other detail. Computer presentations of the characters is a separate aspect put on UTFs. UTFs work with data as an array of bytes. In UTF-8, which is byte-oriented, different characters have different size, in UTF-16 some characters take 16 bits (even ASCII), and some take 32-bits, a pair of 16-bit words called "surrogate pair".

Please see to remove confusion:[^],[^].

Just in case, see my other answer on the topic: How do i convert from ascii to unicode in C#[^].

You don't have to do anything special to pass Unicode text in you Web service, but you should work with Unicode text or characters, not with UTFs. As you work with SOAP, the soup file/stream supports UTF-8. It should be prescribed in its "HTTT-EQUIV".

Share this answer
thatraja 22-Dec-11 14:46pm    
Sergey Alexandrovich Kryukov 22-Dec-11 14:57pm    
Thank you, Raja.
esmailian 23-Dec-11 6:42am    
I can't find a solution about this promblem plz help me by a code . how can convert a encoding in other encoding or write a trick code .
I SOLVED this problem !!!

in nusoap.php file search for
var $soap_defencoding = 'ISO-8859-1';
and chenge to var
$soap_defencoding = 'UTF-8';

Share this answer
hanksterr7 29-Jun-17 10:42am    
You're my hero! Thanks for this simple answer. Worked for me.
Hi, worked for me this:

$client = new nusoap_client(URL, true);
$client->decode_utf8 = false;

Best regards
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900