Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[apache2 .php/utf-8] Pas d'utf-8 en php ?...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
manu.acl
Guru
Guru


Joined: 29 Jan 2005
Posts: 426
Location: Paris

PostPosted: Thu Jan 12, 2006 8:46 pm    Post subject: [apache2 .php/utf-8] Pas d'utf-8 en php ?... Reply with quote

Bon, petit soucis sur une install toute fraiche d'apache2 (sur un mac os).

Je code ma petite page :
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
   <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
   <title>Test charset</title>
</head>
<body>
   éèàùñ
</body>
</html>

Je me connecte dessus avec mon firefox et... la page s'affiche en iso-8859-1.
Donc vous l'aurez compris, pas d'accents mais des caractères incompréhensibles à la place.

Avec l'apache2 de ma gentoo ça s'affiche pourtant bien en utf-8 :roll:

J'utilise le serveur apache2 sur mon iBook pour faire le développement de mes pages, donc ça serait sympa que ça marche correctement non ? :o

<edit>
Je remarque à l'instant que ça ne le fait qu'avec les fichiers .php.
En effet les fichiers .html en utf-8 sont bel et bien lus en utf-8
</edit>


Last edited by manu.acl on Thu Jan 12, 2006 11:35 pm; edited 3 times in total
Back to top
View user's profile Send private message
yoyo
Bodhisattva
Bodhisattva


Joined: 04 Mar 2003
Posts: 4273
Location: Lyon - France

PostPosted: Thu Jan 12, 2006 9:03 pm    Post subject: Reply with quote

Hello manu.acl,

Bien que tes goûts en matière de BDs soient excellents :wink:, je me dois de te rappeler de modifier ton titre afin qu'il corresponde à ce qui a été défini ici (section 3/3) : https://forums.gentoo.org/viewtopic-t-69179.html.
Merci.

Enjoy !

PS : je n'ai pas les compétences pour ton problème, désolé.
_________________
La connaissance s'accroît quand on la partage.
JCB
Back to top
View user's profile Send private message
manu.acl
Guru
Guru


Joined: 29 Jan 2005
Posts: 426
Location: Paris

PostPosted: Thu Jan 12, 2006 9:17 pm    Post subject: Reply with quote

Oui bon, je viens pas tous les jours, ça arrive de faire un oubli :roll:

Autrement avec apache 1.3 ça marche niquel :|
Je vais donc continuer à utiliser cette version pour le moment si personne ne met met sur la voie d'une éventuelle solution :mrgreen:
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1902
Location: 127.0.0.1

PostPosted: Thu Jan 12, 2006 9:21 pm    Post subject: Reply with quote

Salut,

Pas çà ?
/etc/apache2/httpd.conf wrote:

#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it. Specifying it as
# a default does little harm; as the standard dictates that a page
# is in iso-8859-1 (latin1) unless specified otherwise i.e. you
# are merely stating the obvious. There are also some security
# reasons in browsers, related to javascript and URL parsing
# which encourage you to always set a default char set.
#
#AddDefaultCharset ISO-8859-1
AddDefaultCharset UTF-8

Edit : oui, ok, qu'en php.
En php, peut-être en envoyant un header.


Last edited by netfab on Thu Jan 12, 2006 9:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
guilc
Bodhisattva
Bodhisattva


Joined: 15 Nov 2003
Posts: 3326
Location: Paris - France

PostPosted: Thu Jan 12, 2006 9:25 pm    Post subject: Reply with quote

NetFab wrote:
Salut,

Pas çà ?
/etc/apache2/httpd.conf wrote:

#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it. Specifying it as
# a default does little harm; as the standard dictates that a page
# is in iso-8859-1 (latin1) unless specified otherwise i.e. you
# are merely stating the obvious. There are also some security
# reasons in browsers, related to javascript and URL parsing
# which encourage you to always set a default char set.
#
#AddDefaultCharset ISO-8859-1
AddDefaultCharset UTF-8

Oui, c'est ça. En tous cas, chezmoiçamarche avec cette directive :)
_________________
Merci de respecter les règles du forum.

Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing
Back to top
View user's profile Send private message
yoyo
Bodhisattva
Bodhisattva


Joined: 04 Mar 2003
Posts: 4273
Location: Lyon - France

PostPosted: Thu Jan 12, 2006 9:37 pm    Post subject: Reply with quote

manu.acl wrote:
Oui bon, je viens pas tous les jours, ça arrive de faire un oubli :roll:
Comme pour nous tous. :wink:
Simplement, ça rentre dans mes "attributions" de rappeler ce genre de chose (c'est pas la partie la plus agréable crois-moi). Dans tous les cas, si je t'ai donné l'impression d'être agressif, ça n'était pas mon intention (d'autant qu'avec Gally/Anita en avatar tu rentres d'office parmis mes chouchous :lol: ).
_________________
La connaissance s'accroît quand on la partage.
JCB
Back to top
View user's profile Send private message
kernelsensei
Bodhisattva
Bodhisattva


Joined: 22 Feb 2004
Posts: 5619
Location: Woustviller/Moselle/FRANCE (49.07°N;7.02°E)

PostPosted: Thu Jan 12, 2006 9:53 pm    Post subject: Reply with quote

yoyo wrote:
Dans tous les cas, si je t'ai donné l'impression d'être agressif, ça n'était pas mon intention (d'autant qu'avec Gally/Anita en avatar tu rentres d'office parmis mes chouchous :lol: ).


Waaaaaahhhhh, il fait du favoritisme l'autre !!!
_________________
$ ruby -e'puts " .:@BFegiklnorst".unpack("x4ax7aaX6ax5aX15ax4aax6aaX7ax2aX5aX8 \
axaX3ax8aX4ax6aX3aX6ax3ax3aX9ax4ax2aX9axaX6ax3aX2ax4ax3aX4aXaX12ax10aaX7a").join'
Back to top
View user's profile Send private message
manu.acl
Guru
Guru


Joined: 29 Jan 2005
Posts: 426
Location: Paris

PostPosted: Thu Jan 12, 2006 10:02 pm    Post subject: Reply with quote

yoyo wrote:
d'autant qu'avec Gally/Anita en avatar tu rentres d'office parmis mes chouchous :lol:

héhé :P (s/Anita/Alita/).

Pour en revenir à nos moutons,
AddDefaultCharset UTF-8 n'est pas dans le fichier de config de mon apache2 sur ma gentoo et pourtant les fichiers sont bien lus en utf-8. La vérité est ailleurs... (j'ai déjà lu ça quelque part).
Back to top
View user's profile Send private message
marvin rouge
Veteran
Veteran


Joined: 01 Aug 2004
Posts: 1422
Location: Villa Lumierrante, Zonelibre

PostPosted: Fri Jan 13, 2006 7:59 am    Post subject: Reply with quote

- c'est pas un problème de browser ? (autodétection, toussa ... mais si tu fais tes tests avec le même, ça devrait pas être le problème)
- je ne sais pas si ça a une influence, mais ton header ne me semble pas correct: tu ne peux pas servir du xhtml1.1 en content="text/html". Pour ça, il faut utiliser du xhtml 1.0. Le xhtml 1.1 se sert en "application/xhtml+xml".

sinon ici le php fonctione en utf-8 juste avec le AddDefaultCharset.

+

EDIT bon, je viens de tester sur mon serveur, ton script passe avec tes headers, les accents sont bons. Ton fichier php est enregistré en utf-8 ? Parce que si je l'encode en iso8859-15, il me renvoie des caractères bizarres.
Back to top
View user's profile Send private message
yoyo
Bodhisattva
Bodhisattva


Joined: 04 Mar 2003
Posts: 4273
Location: Lyon - France

PostPosted: Fri Jan 13, 2006 8:10 am    Post subject: Reply with quote

kernel_sensei wrote:
yoyo wrote:
Dans tous les cas, si je t'ai donné l'impression d'être agressif, ça n'était pas mon intention (d'autant qu'avec Gally/Anita en avatar tu rentres d'office parmis mes chouchous :lol: ).
Waaaaaahhhhh, il fait du favoritisme l'autre !!!
Jaloux ??? :P

manu.acl wrote:
héhé :P (s/Anita/Alita/).
:roll:
Je devais être bien fatigué hier soir, j'ai débité un tas de conne*.

EDIT : bon fini les OFF TOPIC sinon les modos vont nous bannir ... :mrgreen:
_________________
La connaissance s'accroît quand on la partage.
JCB
Back to top
View user's profile Send private message
manu.acl
Guru
Guru


Joined: 29 Jan 2005
Posts: 426
Location: Paris

PostPosted: Fri Jan 13, 2006 12:08 pm    Post subject: Reply with quote


  • marvin rouge wrote:
    c'est pas un problème de browser ? (autodétection, toussa ... mais si tu fais tes tests avec le même, ça devrait pas être le problème)

    Le pb se trouve coté serveur, il n'y a aucun doute :
    manu.acl wrote:
    Avec l'apache2 de ma gentoo ça s'affiche pourtant bien en utf-8 :roll:

    manu.acl wrote:
    Autrement avec apache 1.3 ça marche niquel :|




  • marvin rouge wrote:
    je ne sais pas si ça a une influence, mais ton header ne me semble pas correct: tu ne peux pas servir du xhtml1.1 en content="text/html". Pour ça, il faut utiliser du xhtml 1.0. Le xhtml 1.1 se sert en "application/xhtml+xml".

    J'ai trouvé un site qui dit de faire comme ça :
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR">

    Le meta content a-t-il toujours une importance si je déclare ma page de cette manière ?

    [edit]
    J'ai ma réponse :
    Parse error: parse error in /Library/WebServer/neovega/DevPHP/index.php on line 1
    [/edit]



  • marvin rouge wrote:
    Ton fichier php est enregistré en utf-8 ? Parce que si je l'encode en iso8859-15, il me renvoie des caractères bizarres.

    Le fichier est bien en utf-8
Back to top
View user's profile Send private message
marvin rouge
Veteran
Veteran


Joined: 01 Aug 2004
Posts: 1422
Location: Villa Lumierrante, Zonelibre

PostPosted: Fri Jan 13, 2006 1:19 pm    Post subject: Reply with quote

Petite réponse pour l'en-tête (qui n'a rien à voir avec ton problème d'utf8, désolé)

Ton exemple:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
   <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
...

Si tu utilise DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" alors il faut avoir <meta http-equiv="Content-type" content="application/xhtml+xml; charset=UTF-8" />

Ce qui n'est pas pareil que ton dernier exemple (XHTML 1.0 Transitional) :)

Sources: choisir une DTD et le bon type MIME pour XHTML (voir le tableau).

Mais ça va pas t'aider avec ton problème d'utf8 :/
Back to top
View user's profile Send private message
manu.acl
Guru
Guru


Joined: 29 Jan 2005
Posts: 426
Location: Paris

PostPosted: Fri Jan 13, 2006 6:36 pm    Post subject: Reply with quote

oui, ce qui me semblait bizare c'est l'annonce du xhtml 1.0 et l'utilisation d'un .dtd xhtml11 :roll:
manu.acl wrote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">.....................

zut, au temps pour moi, j'avais mal lu ^^

Mais ça résoud toujours pas mon problème d'apache2 qui veut pas lire mes .php en utf-8 :?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum