-
php showing � instead of £
Sorry everyone I think I posted my last post about this in javascript which was probably wrong, sorry I'm very new here.
Could someone please advise how I correct the above issue? I'm not fab at coding and am an absolute novice but I'm trying to get there. 
I have installed an new oscommerce template on my onlinestore which uses php. My store default currency is UK Pound and I've also added £ in case this is the problem but to no avail.
This new pop up window displays the product price with a � symbol instead of a £ symbol and I was told it sounded like it was due to an error on parsing the currency symbol.
I don't understand strings and all that stuff so don't really know what I'm looking at as I can't interepret it. Its not that I haven't tried, it just doesn't translate in my mind.
If anyone can help me with this problem I would be so grateful, I have now been trying to rectify it for 9 hours solid 
Thankyou
-
-
Aside from the basic standard symbols (the ASCII set), characters are stored different in different encodings. This means that if you try to read the bytes that make up a pound symbol in one encoding through another encoding, it will display some random other symbol-- often one that cannot be properly displaced, so you get that "unknown character" symbol.
This means that somewhere in the process of typing through displaying that symbol, the character encoding incorrectly changed. In other words, you have two mismatching settings somewhere on your site.
The most common cause of this can be when you are using a database that is set to a different character encoding than your HTML. Unfortunately without having direct access to your server and doing a lot of testing, it's not possible to give an absolute answer about exactly how this is a problem.
How is your text being stored?
The solution is to make sure that every part of your site uses the same character encoding-- HTML, PHP parser, database, text files (the format they are "physically" saved in), etc.
The standard solution is to use unicode (UTF8) as that standard encoding since it supports all characters in a standard way. This might mean you'll actually lose some data (you can reconstruct it if you make copies now) while switching because this will just fix it for the new system, but not necessarily fix all of the old data.
The first step is to add a meta tag specifying the character encoding in the HTML. Then after that try to look through the other possibilities such as the database to make sure they match that.
Instead of unicode, you could try to make it match the database's encoding directly, but in the future of your site this may cause problems if you need to use other characters that are not supported in whatever character set you're using-- what if you want to translate some pages into Chinese? Or maybe just add some unusual punctuation symbols (like the pound symbol, but less common).
However, since you are using online store software, this may be the problem and you either need to rewrite it (well, change a bit here and there) or use something else. Or it's installed wrong or there's a setting. For specific help with that, please tell us details about the software you're using. But you'd actually get more help contacting the company that makes the software since most users here probably won't have ever used that specific software.
One interesting aspect is that the symbol is not displaying even correctly when you use the HTML entity. (&....). That should work.
What happens if you type this directly into the HTML source code of a page? If it works there, using the current settings of your site (do this on an existing page where the pound symbol is not working), then that means the encoding does not match the encoding somewhere else. If not, it might be a bigger issue, or just that you need to specify an encoding in the HTML.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
Thank you for such an in depth explanation I really appreciate you've taken the time to try to help but I'm bamboozled!
I'm sorry.
The php file that is in question doesn't have the <head> section to put a meta tag in and the js file that supports it doesn't either.
The problem has to lie within this file as I am not having problems with any other symbol displaying incorrectly only when this file is being called upon so the conflict has to be there but I don't know what I'm looking at.
Is it allowed to post code on here so that you could peruse it if you wouldn't mind?
I really appreciate your help
-
-
The code probably will not help. The file you are using may not have a <head> section, but the HTML page that is generated will. This means that the system as a whole will take that file, and perhaps other files, and generate the HTML page.
You are welcome to post the code here (or a link to your site), but if the problem is not entirely within that file, then it won't help (or at least won't be a complete answer). (And unfortunately for helping you, but great for security, PHP code is hidden when viewing a webpage, so a link won't help much either.)
As I said, you may have better luck contacting the company that produces the OS Commerce script, or at least posting specific details of how your system is configured here.
It isn't an easy solution, and there are two parts: first, understanding that there is a mismatching configuration between two character encoding types; second, figuring out the details and how to fix it. But the problem is that since you are using OS Commerce, this is not really in your control, without modifying the script.
You might want to hire someone to actually access your server and fix this for you, since it's not an easy task.
This is similar to having a broken car and telling us that it's making a strange sound. Without a lot more information (and hopefully direct hands-on analysis), it's difficult to explain what might be wrong exactly. And unless you can learn all about auto mechanics, you can't fix it yourself either. (But the good news is that I think this is actually significantly similar than learning "all of auto mechanics", so do try to learn this if you have the time. It'll start to make more sense as you do more with it.)
Also, the biggest problem is locating exactly where the problem is occurring; after that it will be relatively simple to fix it-- it's not the fixing step that is hard here. It's the diagnosis.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks