Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3134

Re: PHP, MySQL and UTF-8?

From "A" <a@a.a>
Newsgroups comp.lang.php
Subject Re: PHP, MySQL and UTF-8?
Date 2011-09-12 22:27 +0200
Organization B.net Hrvatska d.o.o.
Message-ID <j4lq1g$e8t$1@gregory.bnet.hr> (permalink)
References <9d6ralFrpkU1@mid.uni-berlin.de> <slrnj6snh2.bek.hellsop@nibelheim.ninehells.com>

Show all headers | View raw


1. Your <head> must have this:

    <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    </head>

2. If you load from template file and then print, your template file must be 
saved in UTF-8 (I'm not sure if BOM must be present, try with or without 
it) - UTF8 BOM is 0xEF 0xBB 0xBF - http://unicode.org/faq/utf_bom.html#bom1

3. Execute these queries before querying database rows (only once is 
needed):

    SET CHARACTER SET utf8;
    SET NAMES utf8;

4. After the two above you should be able to retrieve them properly and 
print them as the should be.

Does that help? 

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

PHP, MySQL and UTF-8? Robert Latest <boblatest@yahoo.com> - 2011-09-12 16:46 +0000
  Re: PHP, MySQL and UTF-8? Jerry Stuckle <jstucklex@attglobal.net> - 2011-09-12 15:30 -0400
  Re: PHP, MySQL and UTF-8? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-09-12 14:31 -0500
    Re: PHP, MySQL and UTF-8? "A" <a@a.a> - 2011-09-12 22:27 +0200
  Re: PHP, MySQL and UTF-8? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-09-13 16:53 +0200

csiph-web