Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Special characters.

0 views
Skip to first unread message

Defacta

unread,
Aug 28, 2007, 9:24:03 AM8/28/07
to
Hi,

When I put in a textarea some french charactes, when I get them back
with a SQL request, all is correct.

With phpMyAdmin, in the database, I can see this:

Et voilà que la star de l\'Internet met cette fois la voûte
céleste à portée de souris grâce à une nouvelle option baptisée

But on another server, with the same PHP code, in the database I have
this:

Et voilà que la star de l'Internet met cette fois la voûte
céleste à portée de souris grâce à une nouvelle option baptisée

Knowing that the PHP code is the same and the browsers too, which
difference in the config files (PHP or MySQL) can affect the
characters ?

Thanks,
Vincent.

Jerry Stuckle

unread,
Aug 28, 2007, 11:52:40 AM8/28/07
to
Defacta wrote:
> Hi,
>
> When I put in a textarea some french charactes, when I get them back
> with a SQL request, all is correct.
>
> With phpMyAdmin, in the database, I can see this:
>
> Et voilą que la star de l\'Internet met cette fois la voūte
> céleste ą portée de souris grāce ą une nouvelle option baptisée

>
> But on another server, with the same PHP code, in the database I have
> this:
>
> Et voilà que la star de l'Internet met cette fois la voûte
> céleste à portée de souris grâce à une nouvelle option baptisée

>
> Knowing that the PHP code is the same and the browsers too, which
> difference in the config files (PHP or MySQL) can affect the
> characters ?
>
> Thanks,
> Vincent.
>

I'd say more probably MySQL.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Defacta

unread,
Aug 28, 2007, 12:13:08 PM8/28/07
to
On 28 août, 16:52, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Defacta wrote:
> > Hi,
>
> > When I put in a textarea some french charactes, when I get them back
> > with a SQL request, all is correct.
>
> > With phpMyAdmin, in the database, I can see this:
>
> > Et voilà que la star de l\'Internet met cette fois la voûte
> > céleste à portée de souris grâce à une nouvelle option baptisée

>
> > But on another server, with the same PHP code, in the database I have
> > this:
>
> > Et voilà que la star de l'Internet met cette fois la voûte
> > céleste à portée de souris grâce à une nouvelle option baptisée

>
> > Knowing that the PHP code is the same and the browsers too, which
> > difference in the config files (PHP or MySQL) can affect the
> > characters ?
>
> > Thanks,
> > Vincent.
>
> I'd say more probably MySQL.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Ok, I do
$body = htmlentities($body, ENT_NOQUOTES, "UTF-8") ;
And this works...

Actually there was some troubles because I must do an urlencode of the
$body variable.

:)

Vincent.

Michael Fesser

unread,
Aug 28, 2007, 8:02:08 PM8/28/07
to
.oO(Defacta)

>Ok, I do
> $body = htmlentities($body, ENT_NOQUOTES, "UTF-8") ;
>And this works...

Shouldn't be necessary.

>Actually there was some troubles because I must do an urlencode of the
>$body variable.

Huh? Why?

Your problem is caused by an improper encoding declaration somewhere. If
you want to use UTF-8, you have to

* store the data in UTF-8 columns in the database
* make sure the connection to the DB uses UTF-8 when inserting and
fetching data
* return the page to the browser with a proper charset parameter in its
HTTP Content-Type header

I'm also wondering about this from your first posting:

| Et voilà que la star de l\'Internet met cette fois la voûte

Where's the backslash coming from? It shouldn't be there. Was it just a
display problem or is it really stored like that in the DB?

Micha

0 new messages