merci beaucoup je vais essayer ça.

-----Message d'origine-----
De : Philippe Vollenweider [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 11 août 2006 17:40
À : [email protected]
Objet : Re: encoding d'url


Bonjour,

En règle générale, il faut encoder tous les urls. 
Voici une méthode assez complète pour faire ça:

public static String encode(String s) {
     StringBuffer sbuf = new StringBuffer();
     int len = s.length();
     for (int i = 0; i < len; i++) {
         int ch = s.charAt(i);
         if ('A' <= ch && ch <= 'Z') {           // 'A'..'Z'
             sbuf.append((char)ch);
         } else if ('a' <= ch && ch <= 'z') {    // 'a'..'z'
              sbuf.append((char)ch);
         } else if ('0' <= ch && ch <= '9') {    // '0'..'9'
              sbuf.append((char)ch);
         } else if (ch == ' ') {                 // space
              sbuf.append('+');
         } else if (ch == '-' || ch == '_'               // unreserved
             || ch == '.' || ch == '!'
             || ch == '~' || ch == '*'
             || ch == '\'' || ch == '('
             || ch == ')') {
             sbuf.append((char)ch);
         } else if (ch <= 0x007f) {              // other ASCII
              sbuf.append(hex[ch]);
         } else if (ch <= 0x07FF) {              // non-ASCII <= 0x7FF
              sbuf.append(hex[0xc0 | (ch >> 6)]);
              sbuf.append(hex[0x80 | (ch & 0x3F)]);
         } else 
{                                        // 0x7FF < ch <= 0xFFFF
              sbuf.append(hex[0xe0 | (ch >> 12)]);
              sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]);
              sbuf.append(hex[0x80 | (ch & 0x3F)]);
         }
     }
     return sbuf.toString();
}

At 11.08.2006 17:29, you wrote:
>Bonjour,
>une de mes jsp fait intervenir un lien mailto du type:
>  <a href="mailto:[EMAIL PROTECTED]'réponse 
> à [un champ]">un tire de lien</a>
>
>Les caractères accentués du sujet du mail 
>apparaissent mal (le à devient un à etc..)
>Y a-t-il une transformation particulière 
>effectuée sur les url qui rend ces caractères indisponibles?
>Ou une méthode pour les afficher correctement?
>Merci de vos réponses,
>Alexis Annosse
>Ingénieur études et développements
>Smile - Motoristes Internet
>www.Smile.fr <http://www.Smile.fr>
>Tél : 01 41 40 88 02

-------=[ pvollenweider at jahia dot com ]=---------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company

Répondre à