Re: problem with charset



..oO(cappa)

i've some problem to print to screen and save date in mysql if the
entries contain char like à,è...
i try to read some post but i'm not able to solve my problem.

i use easyphp 1.8 with
apache 1.3.33-php 4.3.10-mysql 4.1.9
SO:windows vista home premium

in php.ini i've: default_charset = "utf-8"
[...]

Without going into too much detail (I don't like phpMyAdmin and I don't
like to declare the used charset inside the document itself), just some
general comments about the way how I use UTF-8 in my own framework:

* When creating tables in my database, the fields where I think it might
be necessary are defined as UTF-8, while the rest is usually Latin-1:

CREATE TABLE example (
...
textColumn VARCHAR(100) CHARACTER SET 'utf8',
...
) ENGINE=InnoDB DEFAULT CHARACTER SET latin1;

10.3.4. Column Character Set and Collation
http://www.mysql.org/doc/refman/5.0/en/charset-column.html


* When establishing the connection to the DB, the first query that is
sent by my database script is

SET NAMES 'utf8';

This ensures that transfering the data between the DB and my scripts
will not alter the content.

10.4. Connection Character Sets and Collations
http://www.mysql.org/doc/refman/5.0/en/charset-connection.html


* Finally the content is delivered as UTF-8 to the browser. This is done
by sending an appropriate Content-Type header:

header('Content-Type: text/html; charset=UTF-8');

* * *

In short: You have to make sure that UTF-8 is used all the way from the
database storage through your scripts to the browser.

HTH
Micha
.



Relevant Pages

  • Re: Creating XML from an Oracle DB
    ... answer to what must be a FAQ when generating XML from Oracle but I ... an Oracle 9.2 database using DBMS_XMLQUERY and DBMS_LOB. ... Oracle's utf-8 support for the XML packages is shameful. ... You can determine your database's character set with this query: ...
    (perl.dbi.users)
  • RE: LANG system environment variable
    ... So, if I understand you correctly, I would be better off leaving the system the way it is and change the database data to UTF-8? ... > character set the other expects. ... > to store umlaut characters and accents. ...
    (Fedora)
  • Re: character sets
    ... Set your MySQL server's character set to UTF-8. ... check if you currently have UTF-8 support. ... UTF-8 as the default character set for your database: ...
    (comp.lang.php)
  • RE: test_dynamic Error 29 installing DBD-Oracle v 1.15 on red hat 9 Oracle 9.2
    ... That looks a lot like a UTF-8 issue. ... but your database is an 8-bit character set such as WE8ISO8859P15. ... This can't be stored in a WE8ISO8859P15 database, ...
    (perl.dbi.users)
  • Re: Im sure glad I didnt buy a Mac Mini!
    ... MS isn't making you send UTF-8 from your Mac to people who have trouble ... >>>> No, it's just Outlook. ... > emails from maccies are not using old versions of Outlook. ... But then you probably have no idea what the difference is between a character set and a font. ...
    (comp.sys.mac.advocacy)