Hi folks
I have an application written in PHP using Postgresql as the back end.
If I have a text box on a form and in it type a value including a pound sign everything works fine. It is written to the database correctly, and then read back and shown correctly on-screen.
However, in my code to generate a purchase order I embed the pound sign in a string to be displayed and also to be used to update the database. In both cases the pound sign is replaced by a non-standard character.
I assume this is because of a character encoding issue. Can someone tell me what I need to change and to what.
Cheers
Gary
On Wed, Jul 18, 2007 at 04:48:22PM +0100, Gary Stainburn wrote:
Hi folks
I have an application written in PHP using Postgresql as the back end.
If I have a text box on a form and in it type a value including a pound sign everything works fine. It is written to the database correctly, and then read back and shown correctly on-screen.
However, in my code to generate a purchase order I embed the pound sign in a string to be displayed and also to be used to update the database. In both cases the pound sign is replaced by a non-standard character.
I assume this is because of a character encoding issue. Can someone tell me what I need to change and to what.
To which pound sign are you referring? This one: # ("sharp", or "number sign") or this one: � (Pound Sterling)? Given your email address, I conjecture the latter.
If the former, it should display just fine, if you have your character set declared correctly. I recommend UTF-8.
You should probably replace the pound sterling character with its XML character entity. You should do this for any non 7 bit displayable ASCII character. And make sure you declare your character set correctly. See the Character Map program under Applications -> Accessories.
In either case, validate your HTML and CSS. http://validator.w3.org/ and http://jigsaw.w3.org/css-validator/
On Wed, 2007-07-18 at 13:47 -0600, Charles Curley wrote:
You should probably replace the pound sterling character with its XML character entity. You should do this for any non 7 bit displayable ASCII character. And make sure you declare your character set correctly. See the Character Map program under Applications -> Accessories.
There really is no need to use entities for everything that's not part of ASCII in this day and age. Using the right character and declaring the correct encoding is all that's required.
For the sake of simplicity, make sure everything is using the same encoding (set your locale properly, likewise for applications).