Link to home
Start Free TrialLog in
Avatar of Paul Konstanski
Paul KonstanskiFlag for United States of America

asked on

French Character Display Incorrect

I am using an API service that looks up a Bible verse in French and then returns it as a json lable.

The Raw Jason text looks like this:

[{"book_name":"Matthieu","book_id":"Matt","book_order":"55","chapter_id":"28","chapter_title":"Chapter 28","verse_id":"5","verse_text":"Et l\u2019ange, r\u00e9pondant, dit aux femmes: Pour vous, n\u2019ayez point de peur; car je sais que vous cherchez J\u00e9sus le crucifi\u00e9; \n\t\t\t","paragraph_number":"28"},

Open in new window


I know how to grab the text portion of the Json, but it isn't correctly handling the french character sets.  It instead displays it like this:

Et l’ange, répondant, dit aux femmes: Pour vous, n’ayez point de peur; car je sais que vous cherchez Jésus le crucifié; il n’es

Open in new window


In case this doen't display well, I'm attaching a test file that shows this more clearly.  I assume that it has something to do with changing the encoding. The API help desk I'm using isn't answering me to quickly.

Thanks.
frenchText.jpg
Avatar of Predrag Jovic
Predrag Jovic
Flag of Poland image

Try to change problematic characters with html entity.

instead \u2019 use ’  - find replacements for other characters for HTML Entity (decimal)

More details on \u2019
Avatar of Paul Konstanski

ASKER

I don't have control over the text being sent to me. It is what I get. I need to know via PHP how to convert what I've been given into readable text on screen.

What you sent me predgrag doesn't help me do that.  I can't manually go thru and change each entity that is returned.
ASKER CERTIFIED SOLUTION
Avatar of Brian Tao
Brian Tao
Flag of Taiwan, Province of China image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the insight. Your comments helped me see that in my testing I wasn't correctly putting in the character set in the HTML header.

In my application it works fine because character set is in the header. But with the test it was just dumping raw characters which didn't work.

Thanks again for the help.