Solved

French Character Display Incorrect

Posted on 2014-11-05
5
235 Views
Last Modified: 2014-11-06
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
0
Comment
Question by:pkonstan1
5 Comments
 
LVL 26

Expert Comment

by:Predrag Jovic
ID: 40424924
Try to change problematic characters with html entity.

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

More details on \u2019
0
 

Author Comment

by:pkonstan1
ID: 40424941
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.
0
 
LVL 9

Accepted Solution

by:
Brian Tao earned 225 total points
ID: 40425320
It should be an encoding/charset issue.  What's the charset in you page?  Do you have a line in the page source similar to the following?
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Open in new window

0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 275 total points
ID: 40425380
It's a common problem since the world is becoming smaller and more connected day-by-day.  The explanation, as well as guidance about how to fix it, is here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html

I recently made a presentation to the DC PHP User's Group on this subject.  The slide deck is here:
http://www.slideshare.net/RayPaseur/unicode-php-and-character-set-collisions
0
 

Author Closing Comment

by:pkonstan1
ID: 40426725
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Summernote and form validation 10 40
C# SQL BULK INSERT CLASS 5 34
XSLT Help 12 19
How to use xmlReader and idatareader  ? 4 44
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now