'£' symbol refuses to display on my site

Hello,

I am having some difficulty getting the ' £ ' pound symbol to display on my site (www.globexposure.net/index.php). Presently it is shown as a black diamond with a ' ? '  symbol in the middle! You can see it by clicking on a pushpin marker > arrow marker > icon.

I have tried using:
$xmlStr=str_replace(chr(0x163),'£',$xmlStr);
and have set my character encoding as:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

PLEASE DO NOT RESPOND WITHOUT FIRST READING WHAT HAS ALREADY BEEN ATTEMPTED:
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_23883259.html 


Many thanks
DaniishAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
&#8356;

according to wikipedia
0
DaniishAuthor Commented:
Ok i have tried:

$xmlStr=str_replace(chr(0x163),'&#8356;',$xmlStr);


but no joy :(
0
Michel PlungjanIT ExpertCommented:
So there is something ELSE going on

Have a look here:

http://plungjan.name/ee/pound.html

Either works
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

DaniishAuthor Commented:
Yeah i don't doubt that. It's matter of finding out what could be causing there to be an issue, especially since i'm already using that general approach to replace other html special characters.
0
DaniishAuthor Commented:
Perhaps you can see something at fault in my script.
read.php.txt
0
Michel PlungjanIT ExpertCommented:
I would use

header(' Content-type: text/html; charset=utf-8');
0
Michel PlungjanIT ExpertCommented:
and
$xmlStr=str_replace(chr(0x163),'&#8356;',$xmlStr);

$xmlStr=str_replace($poundSign,'&#163;',$xmlStr);

where you define
$poundSign correctly
I do not like the 0x163 since &#163; is decimal and not hex entity which would be
&#xA3; from 0xA3
0
Michel PlungjanIT ExpertCommented:
and use &amp; instead of &#38;

and & is 0x26 and not 38
0
DaniishAuthor Commented:
Thanks for your help mplungian, but still no improvement!
0
DaniishAuthor Commented:
0
DaniishAuthor Commented:
I suspect that the error you get when you view:
http://www.globexposure.net/includes/read.php

in IE is somehow related?!
0
Michel PlungjanIT ExpertCommented:
I am getting
exchange_rate="ý1 = Rs 76.7"

where I expect the <?> I get in firefox is not IE related but due to the character you return isn't UTF-8 but perhaps iso-8859-1 instead
0
Michel PlungjanIT ExpertCommented:
I see
U+00A3 (163)

in that list.
I looked in http://en.wikipedia.org/wiki/Pound_sign

and it is the same.

I see
Smýrrebrýd

it should be

Sm&oslash;rrebr&oslash;d
0
DaniishAuthor Commented:
Using the &oslash; prevents the read.php script from working. When i run it i just get a blank screen:
http://www.globexposure.net/includes/read_o.php

0
Michel PlungjanIT ExpertCommented:
Hmm try

&amp;oslash;
0
DaniishAuthor Commented:
That also results in a blank page:
http://www.globexposure.net/includes/read_o.php
0
Michel PlungjanIT ExpertCommented:
turn on php errors
0
DaniishAuthor Commented:
Sorry how do i do that ?
0
Michel PlungjanIT ExpertCommented:
0
DaniishAuthor Commented:
LOL i thought i had that turned on already & i do:

error_reporting(E_ALL);


Please see my attached script.
read-o.php.txt
0
Michel PlungjanIT ExpertCommented:
Sorry - I do not know
0
DaniishAuthor Commented:
LOL it is pretty random!!
0
Michel PlungjanIT ExpertCommented:
can we backtrack for a moment

Obviously there is an issue of the data you expect is a pound sign not being handled by the script.

Can you perhaps just escape the lot so we can see WHAT is coming out of the database?

e.g. for a moment comment out your replaces and just return a htmlescaped string?
0
DaniishAuthor Commented:
OK this is what my data looks like with £ and ø html special character replace lines commented out:
http://www.globexposure.net/includes/read_o.php
read-o.php.txt
0
Michel PlungjanIT ExpertCommented:
that does NOT make us any cleverer

can you please

change
header("content-type:text/xml");
// Character Set
header(' Content-type: text/html; charset=utf-8');


to

header("content-type:text/xml; charset=utf-8");
0
DaniishAuthor Commented:
OK i have done that.
0
Michel PlungjanIT ExpertCommented:
Now instead of echo the string can you echo a urlencoded string?
0
DaniishAuthor Commented:
Again please can you explain how?
0
DaniishAuthor Commented:
I have just seen this site:
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

which suggests that Pound is typically represented as # - i would say this is a hash! Perhaps that's why it can't find and replace it!
0
Michel PlungjanIT ExpertCommented:
From Wikipedia: The "#" sign is sometimes called "pound sign" in non-sterling countries.

But this is not your issue.

You have in your database some code for some characters. Pound and Smørrebrød are examples

We need to EITHER convert them to UTF-8 OR to entities.

First we need to identify WHAT they are saved as.

Can you change

echo '<national_markers id="'.$row['id'].'" name="'.parseToXML($row['name']).'" lat="'.$row['lat'].'" lng="'.$row['lng'].'" minzl="0" maxzl="'.$row['maxzl'].'" language="'.$row['language'].'" flag="'.$row['flag'].'" currency="'.$row['currency'].'" exchange_rate="'.parseToXML($row['exchange_rate']).'" plugtype="'.parseToXML($row['plugtype']).'" religion="'.$row['religion'].'" tourist_info="'.parseToXML($row['tourist_info']).'" wikipedia="'.parseToXML($row['wikipedia']).'" per_capita_income_PPP="'.parseToXML($row['per_capita_income_PPP']).'" national_dish="'.parseToXML($row['national_dish']).'" useful_phrases="'.parseToXML($row['useful_phrases']).'" icon="pushpin"/>';<national_markers id="'.$row['id'].'" name="'.parseToXML($row['name']).'" lat="'.$row['lat'].'" lng="'.$row['lng'].'" minzl="0" maxzl="'.$row['maxzl'].'" language="'.$row['language'].'" flag="'.$row['flag'].'" currency="'.$row['currency'].'" exchange_rate="'.parseToXML($row['exchange_rate']).'" plugtype="'.parseToXML($row['plugtype']).'" religion="'.$row['religion'].'" tourist_info="'.parseToXML($row['tourist_info']).'" wikipedia="'.parseToXML($row['wikipedia']).'" per_capita_income_ppp="'.parseToXML($row['per_capita_income_PPP']).'" national_dish="'.parseToXML($row['national_dish']).'" useful_phrases="'.parseToXML($row['useful_phrases']).'" icon="pushpin">

to


echo '<national_markers id="'.$row['id'].'" name="'.parseToXML($row['name']).'" lat="'.$row['lat'].'" lng="'.$row['lng'].'" minzl="0" maxzl="'.$row['maxzl'].'" language="'.$row['language'].'" flag="'.$row['flag'].'" currency="'.$row['currency'].'" exchange_rate="'.htmlentities($row['exchange_rate']).'" plugtype="'.parseToXML($row['plugtype']).'" religion="'.$row['religion'].'" tourist_info="'.parseToXML($row['tourist_info']).'" wikipedia="'.parseToXML($row['wikipedia']).'" per_capita_income_PPP="'.parseToXML($row['per_capita_income_PPP']).'" national_dish="'.parseToXML($row['national_dish']).'" useful_phrases="'.parseToXML($row['useful_phrases']).'" icon="pushpin"/>';

and if that is a success, you can do the same for national dish and useful phrases...
0
DaniishAuthor Commented:
I get an XML parsing error: undefined entity

please see this link in FF2:
http://www.globexposure.net/includes/read_o.php
0
Michel PlungjanIT ExpertCommented:
Cool

So now we can do

exchange_rate="'.str_replace('&pound;','&#163;',htmlentities($row['exchange_rate'])).'"

OR

exchange_rate="'.parseToXML(htmlentities($row['exchange_rate'])).'"

and also try
national_dish="'.parseToXML(htmlentities($row['national_dish'])).'"

or just

national_dish="'.htmlentities($row['national_dish']).'"
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertCommented:
Or replace all the pound signs in your database with &#163; and be done with it :)))
0
DaniishAuthor Commented:
Mplungian you legend!

for the £ sign this line worked a treat:
exchange_rate="'.str_replace('&pound;','&#163;',htmlentities($row['exchange_rate'])).'"

i tried the examples you gave for the ' ø ' but they didn't work - please can you tell me what the code would be for this symbol using the above format?


Again many thanks
0
Michel PlungjanIT ExpertCommented:
Did the parsetoXML version not work?


national_dish="'.parseToXML(htmlentities($row['national_dish'])).'"



It is better not to replace.
0
DaniishAuthor Commented:
When i use the following:
national_dish="'.parseToXML(htmlentities($row['national_dish'])).'"

Smørrebrød
appears as:
Sm&oslash;rrebr&oslash;d

Please see this link:
http://www.globexposure.net/includes/read_o.php
0
Michel PlungjanIT ExpertCommented:
Yes, that is what we want!!!

It was the &pound; that is not default recognised by XML

Can you look now in the googla app?
0
Michel PlungjanIT ExpertCommented:
PS: If the google app works, then use the same for the other field (wrap the hmtlentities in the parseXML I mean)
0
DaniishAuthor Commented:
Fantastic i see what you mean now - the parseXML works perfectly.
0
DaniishAuthor Commented:
Thanks ever so much, it took awhile but you persevered and got it sorted.

Thanks again
0
Michel PlungjanIT ExpertCommented:
Have some R&oslash;dgr&oslash;d to celebrate ;)))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.