<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Verdana size=2>A priori, si je fais cette requête d'exécuter 
celle qui m'intéresse, cela fonctionne :</FONT></DIV>
<DIV><FONT face=Verdana size=2>SET CHARACTER SET latin1 (source: <A 
href="http://cestadire.ch/index.php?option=com_content&amp;task=view&amp;id=53&amp;Itemid=53">http://cestadire.ch/index.php?option=com_content&amp;task=view&amp;id=53&amp;Itemid=53</A>)</FONT></DIV>
<DIV><FONT face=Verdana size=2>Que se passe-t-il exactement ?</FONT></DIV>
<DIV><FONT face=Verdana size=2>Quelqu'un a-t-il une idée ?</FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana size=2>Merci d'avance</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>
<HR>
<FONT style="FONT-SIZE: 9px; COLOR: #00adce; FONT-FAMILY: Verdana"><FONT 
style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #0c4da2">Cédric 
Marfil</FONT><BR>Concepteur Réalisateur Intégrateur Confirmé<BR><B>Tél. 
direct:</B> 03.20.65.34.82<BR><B>Mail:</B> 
cedric.marfil@capgemini.com<BR><BR><FONT 
style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #0c4da2">Cap</FONT><FONT 
style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #00adce">gemini</FONT><BR>181 
rue Jules Delcenserie<BR>59700 Marcq en Baroeul<BR></FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=cedric.marfil@capgemini.com 
  href="mailto:cedric.marfil@capgemini.com">Cedric Marfil</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=cps-users-fr@lists.nuxeo.com 
  href="mailto:cps-users-fr@lists.nuxeo.com">cps-users-fr@lists.nuxeo.com</A> ; 
  <A title=ogrisel@nuxeo.com href="mailto:ogrisel@nuxeo.com">Olivier Grisel</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, October 06, 2006 12:19 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [CPS-users-fr] Re: Encodage 
  de caractères MySQL</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Verdana size=2>A priori, ma base est bien encodée en latin1, 
  si je fais un script d'export de celle-ci sur mon client SQL, il me génère 
  ceci:</FONT></DIV>
  <DIV><FONT face=Verdana size=2>CREATE DATABASE `XXX`<BR>&nbsp;&nbsp;&nbsp; 
  CHARACTER SET 'latin1'<BR>&nbsp;&nbsp;&nbsp; COLLATE 
  'latin1_swedish_ci';</FONT></DIV>
  <DIV><FONT face=Verdana size=2>Donc ma base doit être encodée en 'latin1', mon 
  defaultencoding python est setté par le sitecustomize.py sur 'latin-1'. J'ai 
  essayé aussi 'latin1' dans le sitecustomize, mais rien ne semble y 
  faire.</FONT></DIV>
  <DIV><FONT face=Verdana size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Verdana size=2>Je ne comprend pas ce qu'il se 
  passe</FONT></DIV>
  <DIV><FONT face=Verdana size=2>Est-ce qu'une des libs python utilisées 
  pourrait transformer l'encodage à la volée ?</FONT></DIV>
  <DIV><FONT face=Verdana size=2></FONT>&nbsp;</DIV>
  <DIV>
  <HR>
  <FONT style="FONT-SIZE: 9px; COLOR: #00adce; FONT-FAMILY: Verdana"><FONT 
  style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #0c4da2">Cédric 
  Marfil</FONT><BR>Concepteur Réalisateur Intégrateur Confirmé<BR><B>Tél. 
  direct:</B> 03.20.65.34.82<BR><B>Mail:</B> <A 
  href="mailto:cedric.marfil@capgemini.com">cedric.marfil@capgemini.com</A><BR><BR><FONT 
  style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #0c4da2">Cap</FONT><FONT 
  style="FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #00adce">gemini</FONT><BR>181 
  rue Jules Delcenserie<BR>59700 Marcq en Baroeul<BR></FONT></DIV>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=ogrisel@nuxeo.com href="mailto:ogrisel@nuxeo.com">Olivier 
    Grisel</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A 
    title=cps-users-fr@lists.nuxeo.com 
    href="mailto:cps-users-fr@lists.nuxeo.com">cps-users-fr@lists.nuxeo.com</A> 
    </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, October 06, 2006 11:59 
    AM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> [CPS-users-fr] Re: Encodage de 
    caractères MySQL</DIV>
    <DIV><BR></DIV>Cedric Marfil a écrit :<BR>&gt; Bonjour,<BR>&gt; J'ai une 
    base de données MySQL, sur un serveur Gentoo, encodée en 'latin1'.<BR>&gt; 
    J'utilise les librairies python suivantes pour m'y 
    connecter:<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; - MySQL-Python 
    1.2.1_p2<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; - ZMySQLDA 2.0.8<BR>&gt; Quand je 
    fais une requête sur la base, il semblerait que les résultats <BR>&gt; me 
    reviennent au format 'utf-8'.<BR>&gt; J'ai créé un fichier sitecustomize.py 
    qui définit mon encodage par <BR>&gt; défaut à 'latin-1'.<BR>&gt; Rien n'y 
    fait, j'ai toujours mes résultats en 'utf-8'.<BR>&gt; Ce qui m'étonne c'est 
    de ne pas retrouver de paramètre sur mon <BR>&gt; connecteur ZMySQLDA qui me 
    permettrait de définir l'encodage désiré, <BR>&gt; comme c'est le cas pour 
    le connecteur ZPsycoPgDA.<BR>&gt; Avez vous une idée sur ce qui peut 
    provoquer l'envoi des résultats au <BR>&gt; format 'utf-8' ?<BR><BR>Le fait 
    que les données stockées le soit en utf8 ? AMA MySQL ne s'amuse pas à 
    <BR>transcoder les chaines de caractères à la volée. Donc si on stocke de 
    l'utf8 on <BR>recupère de l'utf8. Il suffit juste de transcoder ces 
    résultats en latin 9 <BR>(iso-8859-15) si on veut les afficher dans une page 
    html générée par 
    CPS.<BR><BR>result_str.decode('utf-8').encode('iso-8859-15', 
    'replace')<BR><BR>Le flag 'replace' permet de remplacer les caractères utf-8 
    non existant en <BR>latin9 par un '?'. Dans CPSUtil on fournit en plus un 
    fallback supplémentaire <BR>chargé automatiquement dans CPS qui permet de 
    faire des conversions <BR>intelligentes pour les caractères windows 
    (cp1252):<BR><BR>result_str.decode('utf-8').encode('iso-8859-15', 
    'latin9_fallback')<BR><BR>Les détails dans :<BR>&nbsp; <A 
    href="http://svn.nuxeo.org/trac/pub/browser/CPS3/products/CPSUtil/trunk/text.py">http://svn.nuxeo.org/trac/pub/browser/CPS3/products/CPSUtil/trunk/text.py</A><BR><BR><BR>-- 
    <BR>Olivier<BR><BR>_______________________________________________<BR>cps-users-fr 
    <BR>Adresse de la liste : <A 
    href="mailto:cps-users-fr@lists.nuxeo.com">cps-users-fr@lists.nuxeo.com</A><BR>Gestion 
    de l'abonnement : &lt;<A 
    href="http://lists.nuxeo.com/mailman/listinfo/cps-users-fr">http://lists.nuxeo.com/mailman/listinfo/cps-users-fr</A>&gt;</BLOCKQUOTE>
  <TABLE>
    <TBODY>
    <TR>
      <TD bgColor=#ffffff><FONT color=#000000>This message contains 
        information that may be privileged or confidential and is the property 
        of the Capgemini Group. It is intended only for the person to whom it is 
        addressed. If you are not the intended recipient, you are not authorized 
        to read, print, retain, copy, disseminate, distribute, or use this 
        message or any part thereof. If you receive this message in error, 
        please notify the sender immediately and delete all copies of this 
        message.<BR><BR></FONT></TD></TR></TBODY></TABLE>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>cps-users-fr 
  <BR>Adresse de la liste : cps-users-fr@lists.nuxeo.com<BR>Gestion de 
  l'abonnement : 
&lt;http://lists.nuxeo.com/mailman/listinfo/cps-users-fr&gt;<BR></BLOCKQUOTE></BODY></HTML>

<table><tr><td bgcolor=#ffffff><font color=#000000>This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.<br>
<br>
</font></td></tr></table>