Robert Strauch
Robert Strauch

Reputation: 12896

String encoding of Arabic characters in UTF-8

An Arabic name shall be sent via SOAP. The name is encoded like this:

<value>&#217;&#133;&#216;&#173;&#217;&#133;&#216;&#175; &#216;&#185;&#216;&#168;&#216;&#175;&#216;&#167;&#217;&#132;&#217;&#132;&#217;&#135; &#217;&#135;&#217;&#132;&#216;&#167;&#217;&#132;</value>

However when converting the above to UTF-8 with some online converters the result looks like this:
محمد عبدالله هلال

What am I missing here so that the correct Arabic characters are displayed?

Thanks,
Robert

Upvotes: 1

Views: 4624

Answers (2)

Mukund K Roy
Mukund K Roy

Reputation: 165

This has been the problem Sending UTF-8 data from Android. Your code would work fine except that you will have to encode your String to Base64 . At Server you just decode Base64 String back. It worked for me. I can share if you need the code.

Upvotes: 1

Joachim Sauer
Joachim Sauer

Reputation: 308061

The encoded data you showed does encode the nonsensical data you showed (or similar, because it actually encodes some unprintable characters as well).

So your input is already wrong.

You might be able to salvage it, but the correct solution would be to make sure that the input is correct in the first place.

Upvotes: 1

Related Questions