Problems with character encoding (UTF-8 vs ISO-8859-1)
18 de julho de 2012 in Etiquetas: Berbicachos, MySQL, PHP
Whenever I need to do something in HTML, PHP and / or MySQL, here comes the problem of character encoding!In MySQL coding I use is utf8_general_ci and use HTML charset = UTF-8.
At the outset, it seems that everything should go well!
It turns out that by default when the connection is made to MySQL, the used charset is latin1, which soon spoils the view of the characters (special).
The best solution I got was to put the following statement, following the definition of the database connection (mysql_connect):
# mysql_set_charset ('utf8', $ link);
If you do not use this queisram solution and just want to change the display of one or another variable, one can use the following instructions:
# utf8_encode ($ string);
# htmlentities ($ string);
Normally I use xampp for Linux (lampp) to program these platforms, but must also occur in other (even Windows users). This happens to me always to the point of me going through with this, so today I decided to spend one hour of my life researching with feet and head on this.
The character encoding is a subject that gives cloth sleeves! Anyway I think these statements in PHP already help a lot.
Etiquetas
- Aplicativos (3)
- Bash/Shell (9)
- Berbicachos (3)
- CM (15)
- Debian (17)
- FreeBSD (1)
- Gnome (3)
- Informação (10)
- Jogos (1)
- Kde (3)
- Kubuntu (13)
- LinuxMint (3)
- Multimédia (2)
- MySQL (1)
- openSuse (4)
- Opinião (1)
- PHP (1)
- Rapidinhas (8)
- Tutoriais (3)
- Ubuntu (13)
- Virtualizacao (1)
Seguidores
Interestings Blogs
Popular Posts
-
When it is in principle all councils are few ... So here are some. of who has passed the "as passas do Algarve" to take this to fu...
-
The youtube-dl is a small command-line utility that can download videos from youtube.com too easily. In terms of archives, from the Debian M...
-
If you have problems mounting a floppy drive in linux , you may be receiving the following message : " / dev / tty is not ...
-
If you use XAMPP , can happen to you the problem of MySQL does not start . This usually happens when we copy the XAMPP folde...
-
If you work with more than one computer on your desk, to be sure you felt the need for a utility to share the keyboard and mouse between t...
-
As you know already available version 3.6 of LibreOffice as announced in pplware . You can read more information about new fe...
-
Whenever I need to do something in HTML, PHP and / or MySQL , here comes the problem of character encoding ! In MySQL coding I us...
-
A major difficulty in adapting to any Linux distribution, is to understand your installation system packages. In K / Ubuntu, ie the distribu...
-
At one time published an article, which can read here on remote display in Linux. Now, I will publish another way that allows remote connec...
-
According to this news digital diary ( DD ), the " Linux advances on Windows and Unix in the Enterprise ' ! Needless ...