If I use this tag in all my documents
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
why?, some parts of the code come out as:
Contraseña y Cédula: (html)
ÿEstad usted seguro?(javascript alert)
and in others they come out with normal tilde and eñe:
Ingrese la contraseña y la cédula
If I use &LETRAacute;
it, it accommodates, but there are documents where I don't have it and it also shows the accents and the signs
What can be happening?
I would like the eñe to come out and also the accents, not theñ
you can try the following
If you work in a system with a variety of technologies (php, html, javascript, bbdd, remote calls) you save yourself a lot of problems if you manage everything in the same code. That includes in the case that you work with ´utf-8`:
When you see
ñ
, that is the ISO-8859 representation of añ
utf-8 encoded one, if it is shown to you on a utf-8 page it means that the source of the text was originally utf-8, then it was because of an artifact interpreted as ISO and finally reconverted to utf-8.If you want particular help like making sure you work with utf-8, add a list of the artifacts and tools you use to your question and you might get concrete answers like changing the encoding of this part of your system to utf-8.
To find the source of the errors you have to find out where these texts come from:
If for example the first text is a fixed text in an html file, it means that the file is saved in utf-8, but the page is displayed with ISO-8859.
If the second text is fixed text in your html file, it may be that the html encoding and configuration are the same, still you can't be sure if it's ISO-8859 or utf-8.
To begin with, I recommend that you make sure that all files with fixed texts are saved in utf-8, then see how they are displayed.
If you are using html5 it is better to use this other meta tag:
What I did to solve after reading @StefanNolde's good answer, was the following:
It seems to me that it solves but I think it could be made simpler
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
UTF-8_spanish_ci
WESTERN
, which is a combination (something like that I understood) of encoding betweenUTF-8
,UTF-16
and another one, placing UTF-8 by default in the files.Use
UNICODE
to generate the special characters in Javascript\u00e1 -> á \u00e9 -> é \u00ed -> í \u00f3 -> ó \u00fa -> ú \u00c1 -> Á \u00c9 -> É \u00cd -> Í \u00d3 -> Ó \u00da -> Ú \u00f1 -> ñ \u00d1 -> Ñ \u00BF -> ¿
&LETRAacute;
and&LETRATilde;
.