Special characters.

Special characters.

am 28.08.2007 15:24:03 von vincent.marguerit

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=E0 que la star de l\'Internet met cette fois la vo=FBte
c=E9leste =E0 port=E9e de souris gr=E2ce =E0 une nouvelle option baptis=E9e

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

Et voil=C3 que la star de l'Internet met cette fois la voûte
céleste =C3 portée de souris grâce =C3 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.

Re: Special characters.

am 28.08.2007 17:52:40 von Jerry Stuckle

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.
jstucklex@attglobal.net
==================

Re: Special characters.

am 28.08.2007 18:13:08 von vincent.marguerit

On 28 ao=FBt, 16:52, Jerry Stuckle 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=E0 que la star de l\'Internet met cette fois la vo=FBte
> > c=E9leste =E0 port=E9e de souris gr=E2ce =E0 une nouvelle option baptis=
=E9e
>
> > But on another server, with the same PHP code, in the database I have
> > this:
>
> > Et voil=C3 que la star de l'Internet met cette fois la voûte
> > céleste =C3 portée de souris grâce =C3 une nouvelle op=
tion 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 =3D 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.

Re: Special characters.

am 29.08.2007 02:02:08 von Michael Fesser

..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