|
Posted by ED on 10/19/07 14:59
"Ian Hobson" <ian.hobson@ntlworld.com> wrote in message
news:ZA0Si.9934$7a2.3102@newsfe3-gui.ntli.net...
> Hi guys,
>
> I have a problem that I believe is related to character sets.
>
> I'm in the UK and I need to store £ (GBP currency symbol) in a MySQL
> database, using php, pull it out again and put it into a .pdf file.
>
> On my test machine everythign work fine - the text can be input in a
> text or textarea field, gets processed via mysql_real_escape_string on
> its way to the MySQl database, get stored as the single character
> according to phpMyAdmin. When the data is sent back to the screen both
> display and edit field contents appear correct. The code also create a
> dynamic dpf file, which contains the correct symbol and prints
> correctly.
>
> On the production machine things are slightly different. The character
> is altered as it is stored - an "A with a hat" character is stored
> before the pound symbol. Although this displays correctly on show and
> edit in the browser, the pdf has the "A with hat" symbol prepended,
> and this is also printed.
>
> Although there are small differences in versions between php, and
> apache between the two machines, there are no differences I can see in
> the character sets of database setup, my.ini/cnf , php.ini or
> httpd.conf files.
>
> They both have the database in Latin1 and connection as utf-8.
>
> The production machine is Ubuntu Server LTS "out of the box" (running
> as a VM). The test machine is Win2K with Apache2, PHP5 and MySQl
> 5.0.24a-community-nt - all fairly "out of the box".
>
> Anyone have an idea how I can trace the problem, or how to fix it?
>
> Thanks for your input.
>
> Ian
Hi Ian,
Have you tried utf8_decode() on the text prior to inserting into the DB?
http://uk.php.net/manual/en/function.utf8-decode.php
cheers
ED
Navigation:
[Reply to this message]
|