HTML et affichage d'accent

Calo

Membre confirmé
13 Août 2007
86
2
Nancy
Bonsoir, j'ai un sérieux problème, je débute dans le html , et j'ai fait une magnifique page en html qui s'affiche correctement sous windows, mais sous mac c'est une catastrophe, tous les accents, les "ç" etc s'affichent avec des symboles étranges.

J'ai pourtant vérifier l'encodage, etc (iso-8859-1) mais rien n'y fait
et je ne comprends pas, il n'y a que sous mac que ça ne s'éffiche pas !

Merci de votre aide
 
T'as mis une balise meta pour l'indiquer l'encodage ?
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

Si tu précises rien, il est probable que le navigateur prenne l'encodage par défaut du système, à savoir macroman. Tandis que sous windows il prend l'encodage windows-latin-1, qui à quelques caractères de contrôle prêt est identique à l'iso-8859-1 (unix).
 
ou alors pour se compliquer la vie un peu plus, tu peux avoir recours aux signes html dont tu trouveras une liste ici ...

remplace tes "é" par des "&eacute;" par exemple... normalement ça palie à ton problème ;)
 
Le mieux c'est de vérifier que l'encodage dans la meta correspond bien à l'encodage dans l'éditeur de texte, c'est moins casse-tête. ;)

Puis il faut parfois aussi tenir compte que certains serveurs web sont configuré pour forcer l'encodage à l'envoi de la page...

P.S. : et si c'est possible utilisez UTF-8, au moins l'encodage est complet : tous les caractères sont dispo (et même plus : arabes, asiatiques, etc).
 
Salut,

Il y a quelques temps, j'ai fait un script qui remplace les caractères spéciaux par le code html.

Il faut copier le texte à convertir dans le presse-papiers puis lancer le script, le texte converti se retrouve dans le presse-papiers à la fin de l'exécution… ;)

Bloc de code:
on run
	set listChar to {"á", "Á", "â", "Â", "à", "À", "å", "Å", "ã", "Ã", "ä", "Ä", "æ", "Æ", "ç", "Ç", "é", "É", "ê", "Ê", "è", "È", "ë", "Ë", "í", "î", "ì", "ï", "ñ", "Ñ", "ó", "Ó", "ô", "Ô", "ò", "Ò", "ø", "Ø", "õ", "Õ", "ö", "Ö", "œ", "Œ", "š", "Š", "ß", "ð", "Ð", "þ", "Þ", "ú", "Ú", "û", "Û", "ù", "Ù", "ü", "Ü", "ý", "Ý", "ÿ", "Ÿ", " & ", "©", "®", "™", "§", "¤", "€", "¢", "£", "¥", "ƒ", "\"", "«", "»", "‹", "›", "“", "”", "„", "'", "‘", "’", "‚", "…", "¡", "¿", "¨", "´", "ˆ", "˜", "¸", "·", "•", "¯", "&#8254;", "–", "—", "¦", "†", "‡", "¶", "&#9674;", "&#9824;", "&#9827;", "&#9829;", "&#9830;", "&#8592;", "&#8593;", "&#8594;", "&#8595;", "&#8596;", "&#945;", "&#913;", "&#946;", "&#914;", "&#947;", "&#915;", "&#948;", "&#916;", "&#949;", "&#917;", "&#950;", "&#918;", "&#951;", "&#919;", "&#952;", "&#920;", "&#953;", "&#921;", "&#954;", "&#922;", "&#955;", "&#923;", "&#956;", "&#924;", "&#957;", "&#925;", "&#958;", "&#926;", "&#959;", "&#927;", "&#960;", "&#928;", "&#961;", "&#929;", "&#963;", "&#962;", "&#931;", "&#964;", "&#932;", "&#965;", "&#933;", "&#966;", "&#934;", "&#967;", "&#935;", "&#968;", "&#936;", "&#969;", "&#937;", "°", "µ", "<", ">", "&#8804;", "&#8805;", "&#8776;", "&#8800;", "&#8801;", "±", "&#8722;", "×", "÷", "&#8260;", "‰", "¼", "½", "¾", "¹", "²", "³", "º", "ª", "&#8242;", "&#8243;", "&#8706;", "&#8719;", "&#8721;", "&#8730;", "&#8734;", "¬", "&#8745;", "&#8747;", "&#8658;", "&#8660;", "&#8704;", "&#8707;", "&#8711;", "&#8712;", "&#8715;", "&#8733;", "&#8736;", "&#8743;", "&#8744;", "&#8746;", "&#8756;", "&#8764;", "&#8834;", "&#8835;", "&#8838;", "&#8839;", "&#8869;", "&#8853;", "&#8201;", "&#8194;", "&#8195;", "&#8472;", "&#8465;", "&#8476;", "&#8629;", "&#8656;", "&#8657;", "&#8659;", "&#8709;", "&#8713;", "&#8727;", "&#8773;", "&#8836;", "&#8855;", "&#8901;", "&#8968;", "&#8969;", "&#8970;", "&#8971;", "&#12296;", "&#12297;", "&#8501;", "&#977;", "&#982;", "&#978;"}
	
	set listOk to {"&aacute;", "&Aacute;", "&acirc;", "&Acirc;", "&agrave;", "&Agrave;", "&aring;", "&Aring;", "&atilde;", "&Atilde;", "&auml;", "&Auml;", "&aelig;", "&AElig;", "&ccedil;", "&Ccedil;", "&eacute;", "&Eacute;", "&ecirc;", "&Ecirc;", "&egrave;", "&Egrave;", "&euml;", "&Euml;", "&iacute;", "&icirc;", "&igrave;", "&iuml;", "&ntilde;", "&Ntilde;", "&oacute;", "&Oacute;", "&ocirc;", "&Ocirc;", "&ograve;", "&Ograve;", "&oslash;", "&Oslash;", "&otilde;", "&Otilde;", "&ouml;", "&Ouml;", "&oelig;", "&OElig;", "&scaron;", "&Scaron;", "&szlig;", "&eth;", "&ETH;", "&thorn;", "&THORN;", "&uacute;", "&Uacute;", "&ucirc;", "&Ucirc;", "&ugrave;", "&Ugrave;", "&uuml;", "&Uuml;", "&yacute;", "&Yacute;", "&yuml;", "&Yuml;", " &amp; ", "&copy;", "&reg;", "&trade;", "&sect;", "&curren;", "&euro;", "&cent;", "&pound;", "&yen;", "&fnof;", "&quot;", "&laquo;", "&raquo;", "&lsaquo;", "&rsaquo;", "&ldquo;", "&rdquo;", "&bdquo;", "&apos;", "&lsquo;", "&rsquo;", "&sbquo;", "&hellip;", "&iexcl", "&iquest;", "&uml;", "&acute;", "&circ;", "&tilde;", "&cedil;", "&middot;", "&bull;", "&macr;", "&oline;", "&ndash;", "&mdash;", "&brvbar;", "&dagger;", "&Dagger;", "&para;", "&loz;", "&spades;", "&clubs;", "&hearts;", "&diams;", "&larr;", "&uarr;", "&rarr;", "&darr;", "&harr;", "&alpha;", "&Alpha;", "&beta;", "&Beta;", "&gamma;", "&Gamma;", "&delta;", "&Delta;", "&epsilon;", "&Epsilon;", "&zeta;", "&Zeta;", "&eta;", "&Eta;", "&theta;", "&Theta;", "&iota;", "&Iota;", "&kappa;", "&Kappa;", "&lambda;", "&Lambda;", "&mu;", "&Mu;", "&nu;", "&Nu;", "&xi;", "&Xi;", "&omicron;", "&Omicron;", "&pi;", "&Pi;", "&rho;", "&Rho;", "&sigma;", "&sigmaf;", "&Sigma;", "&tau;", "&Tau;", "&upsilon;", "&Upsilon;", "&phi;", "&Phi;", "&chi;", "&Chi;", "&psi;", "&Psi;", "&omega;", "&Omega;", "&deg;", "&micro;", "&lt;", "&gt;", "&le;", "&ge;", "&asymp;", "&ne;", "&equiv;", "&plusmn;", "&minus;", "&times;", "&divide;", "&frasl;", "&permil;", "&frac14;", "&frac12;", "&frac34;", "&sup1;", "&sup2;", "&sup3;", "&ordm;", "&ordf;", "&prime;", "&Prime;", "&part;", "&prod;", "&sum;", "&radic;", "&infin;", "&not;", "&cap;", "&int;", "&rArr;", "&hArr;", "&forall;", "&exist;", "&nabla;", "&isin;", "&ni;", "&prop;", "&ang;", "&and;", "&or;", "&cup;", "&there4;", "&sim;", "&sub;", "&sup;", "&sube;", "&supe;", "&perp;", "&oplus;", "&thinsp;", "&ensp;", "&emsp;", "&weierp;", "&image;", "&real;", "&crarr;", "&lArr;", "&uArr;", "&dArr;", "&empty;", "&notin;", "&lowast;", "&cong;", "&nsub;", "&otimes;", "&sdot;", "&lceil;", "&rceil;", "&lfloor;", "&rfloor;", "&lang;", "&rang;", "&alefsym;", "&thetasym;", "&piv;", "&upsih;"}

	considering case
		set theText to the clipboard
		repeat with i from 1 to count of items in listChar
			set thisItem to item i of listChar
			if thisItem is in theText then
				set theText to find_replace(theText, thisItem, (item i of listOk))
			end if
		end repeat
	end considering
	set the clipboard to theText
	
end run

on find_replace(the_string, old_char, new_char)
	set AppleScript's text item delimiters to old_char
	set the_list to text items of the_string
	set AppleScript's text item delimiters to new_char
	set the_string to the_list as text
	set AppleScript's text item delimiters to ""
	return the_string
end find_replace
 
Salut,

Il y a quelques temps, j'ai fait un script qui remplace les caractères spéciaux par le code html.

Il faut copier le texte à convertir dans le presse-papiers puis lancer le script, le texte converti se retrouve dans le presse-papiers à la fin de l'exécution… ;)

Bloc de code:
on run
    set listChar to {"á", "Á", "â", "Â", "à", "À", "å", "Å", "ã", "Ã", "ä", "Ä", "æ", "Æ", "ç", "Ç", "é", "É", "ê", "Ê", "è", "È", "ë", "Ë", "í", "î", "ì", "ï", "ñ", "Ñ", "ó", "Ó", "ô", "Ô", "ò", "Ò", "ø", "Ø", "õ", "Õ", "ö", "Ö", "œ", "Œ", "š", "Š", "ß", "ð", "Ð", "þ", "Þ", "ú", "Ú", "û", "Û", "ù", "Ù", "ü", "Ü", "ý", "Ý", "ÿ", "Ÿ", " & ", "©", "®", "™", "§", "¤", "€", "¢", "£", "¥", "ƒ", "\"", "«", "»", "‹", "›", "“", "”", "„", "'", "‘", "’", "‚", "…", "¡", "¿", "¨", "´", "ˆ", "˜", "¸", "·", "•", "¯", "&#8254;", "–", "—", "¦", "†", "‡", "¶", "&#9674;", "&#9824;", "&#9827;", "&#9829;", "&#9830;", "&#8592;", "&#8593;", "&#8594;", "&#8595;", "&#8596;", "&#945;", "&#913;", "&#946;", "&#914;", "&#947;", "&#915;", "&#948;", "&#916;", "&#949;", "&#917;", "&#950;", "&#918;", "&#951;", "&#919;", "&#952;", "&#920;", "&#953;", "&#921;", "&#954;", "&#922;", "&#955;", "&#923;", "&#956;", "&#924;", "&#957;", "&#925;", "&#958;", "&#926;", "&#959;", "&#927;", "&#960;", "&#928;", "&#961;", "&#929;", "&#963;", "&#962;", "&#931;", "&#964;", "&#932;", "&#965;", "&#933;", "&#966;", "&#934;", "&#967;", "&#935;", "&#968;", "&#936;", "&#969;", "&#937;", "°", "µ", "<", ">", "&#8804;", "&#8805;", "&#8776;", "&#8800;", "&#8801;", "±", "&#8722;", "×", "÷", "&#8260;", "‰", "¼", "½", "¾", "¹", "²", "³", "º", "ª", "&#8242;", "&#8243;", "&#8706;", "&#8719;", "&#8721;", "&#8730;", "&#8734;", "¬", "&#8745;", "&#8747;", "&#8658;", "&#8660;", "&#8704;", "&#8707;", "&#8711;", "&#8712;", "&#8715;", "&#8733;", "&#8736;", "&#8743;", "&#8744;", "&#8746;", "&#8756;", "&#8764;", "&#8834;", "&#8835;", "&#8838;", "&#8839;", "&#8869;", "&#8853;", "&#8201;", "&#8194;", "&#8195;", "&#8472;", "&#8465;", "&#8476;", "&#8629;", "&#8656;", "&#8657;", "&#8659;", "&#8709;", "&#8713;", "&#8727;", "&#8773;", "&#8836;", "&#8855;", "&#8901;", "&#8968;", "&#8969;", "&#8970;", "&#8971;", "&#12296;", "&#12297;", "&#8501;", "&#977;", "&#982;", "&#978;"}
    
    set listOk to {"&aacute;", "&Aacute;", "&acirc;", "&Acirc;", "&agrave;", "&Agrave;", "&aring;", "&Aring;", "&atilde;", "&Atilde;", "&auml;", "&Auml;", "&aelig;", "&AElig;", "&ccedil;", "&Ccedil;", "&eacute;", "&Eacute;", "&ecirc;", "&Ecirc;", "&egrave;", "&Egrave;", "&euml;", "&Euml;", "&iacute;", "&icirc;", "&igrave;", "&iuml;", "&ntilde;", "&Ntilde;", "&oacute;", "&Oacute;", "&ocirc;", "&Ocirc;", "&ograve;", "&Ograve;", "&oslash;", "&Oslash;", "&otilde;", "&Otilde;", "&ouml;", "&Ouml;", "&oelig;", "&OElig;", "&scaron;", "&Scaron;", "&szlig;", "&eth;", "&ETH;", "&thorn;", "&THORN;", "&uacute;", "&Uacute;", "&ucirc;", "&Ucirc;", "&ugrave;", "&Ugrave;", "&uuml;", "&Uuml;", "&yacute;", "&Yacute;", "&yuml;", "&Yuml;", " &amp; ", "&copy;", "&reg;", "&trade;", "&sect;", "&curren;", "&euro;", "&cent;", "&pound;", "&yen;", "&fnof;", "&quot;", "&laquo;", "&raquo;", "&lsaquo;", "&rsaquo;", "&ldquo;", "&rdquo;", "&bdquo;", "&apos;", "&lsquo;", "&rsquo;", "&sbquo;", "&hellip;", "&iexcl", "&iquest;", "&uml;", "&acute;", "&circ;", "&tilde;", "&cedil;", "&middot;", "&bull;", "&macr;", "&oline;", "&ndash;", "&mdash;", "&brvbar;", "&dagger;", "&Dagger;", "&para;", "&loz;", "&spades;", "&clubs;", "&hearts;", "&diams;", "&larr;", "&uarr;", "&rarr;", "&darr;", "&harr;", "&alpha;", "&Alpha;", "&beta;", "&Beta;", "&gamma;", "&Gamma;", "&delta;", "&Delta;", "&epsilon;", "&Epsilon;", "&zeta;", "&Zeta;", "&eta;", "&Eta;", "&theta;", "&Theta;", "&iota;", "&Iota;", "&kappa;", "&Kappa;", "&lambda;", "&Lambda;", "&mu;", "&Mu;", "&nu;", "&Nu;", "&xi;", "&Xi;", "&omicron;", "&Omicron;", "&pi;", "&Pi;", "&rho;", "&Rho;", "&sigma;", "&sigmaf;", "&Sigma;", "&tau;", "&Tau;", "&upsilon;", "&Upsilon;", "&phi;", "&Phi;", "&chi;", "&Chi;", "&psi;", "&Psi;", "&omega;", "&Omega;", "&deg;", "&micro;", "&lt;", "&gt;", "&le;", "&ge;", "&asymp;", "&ne;", "&equiv;", "&plusmn;", "&minus;", "&times;", "&divide;", "&frasl;", "&permil;", "&frac14;", "&frac12;", "&frac34;", "&sup1;", "&sup2;", "&sup3;", "&ordm;", "&ordf;", "&prime;", "&Prime;", "&part;", "&prod;", "&sum;", "&radic;", "&infin;", "&not;", "&cap;", "&int;", "&rArr;", "&hArr;", "&forall;", "&exist;", "&nabla;", "&isin;", "&ni;", "&prop;", "&ang;", "&and;", "&or;", "&cup;", "&there4;", "&sim;", "&sub;", "&sup;", "&sube;", "&supe;", "&perp;", "&oplus;", "&thinsp;", "&ensp;", "&emsp;", "&weierp;", "&image;", "&real;", "&crarr;", "&lArr;", "&uArr;", "&dArr;", "&empty;", "&notin;", "&lowast;", "&cong;", "&nsub;", "&otimes;", "&sdot;", "&lceil;", "&rceil;", "&lfloor;", "&rfloor;", "&lang;", "&rang;", "&alefsym;", "&thetasym;", "&piv;", "&upsih;"}

    considering case
        set theText to the clipboard
        repeat with i from 1 to count of items in listChar
            set thisItem to item i of listChar
            if thisItem is in theText then
                set theText to find_replace(theText, thisItem, (item i of listOk))
            end if
        end repeat
    end considering
    set the clipboard to theText
    
end run

on find_replace(the_string, old_char, new_char)
    set AppleScript's text item delimiters to old_char
    set the_list to text items of the_string
    set AppleScript's text item delimiters to new_char
    set the_string to the_list as text
    set AppleScript's text item delimiters to ""
    return the_string
end find_replace

deux lignes de php ou python
:p;) autant utiliser des fonctions de languages built-in plus completes
 
  • J’aime
Réactions: BS0D
deux lignes de php ou python
:p;) autant utiliser des fonctions de languages built-in plus completes

Certainement mais je ne connais pas du tout ces langages… :D

Le peu de html que j'ai fait se résume à mon modeste site en 1 strict… ;)
 
  • J’aime
Réactions: BS0D
En plus tu codes en UTF-8, tu n'as vraiment pas besoin d'utiliser des entités... Tu pourrais même taper des caractères arabes, asiatiques que ça passerait sans problèmes. ;)
 
En plus tu codes en UTF-8, tu n'as vraiment pas besoin d'utiliser des entités... Tu pourrais même taper des caractères arabes, asiatiques que ça passerait sans problèmes. ;)

C'est à moi que s'adresse cette remarque ? :siffle:

J'ai récupéré le texte de l'ancien site, et je ne me suis même pas posé la question…

Merci ;)