You are here: Re: Need help storing special characters like ° (degrees) « PHP SQL « IT news, forums, messages
Re: Need help storing special characters like ° (degrees)

Posted by shimmyshack on 02/20/07 00:02

On 19 Feb, 16:47, "J.O. Aho" <u...@example.net> wrote:
> Pugi! wrote:
> > Whenever I insert a geographical coordinate in database or even in
> > textfile after submit, for example 15°16'18''
> > it ends op like 15°16'18''. é, à, ç, è, ... ends up funny too. It
> > shows ok when displayed on webpage. But it is hardly readable in
> > database or in textfile.
>
> You store UTF-8 characters into your database/files, you still need
> UTF-8 support in the terminal where you display the result, most people
> still uses some sort of ISO8859, in which character with values over 127
> will be represented with a "dual 8-bit character". As the browser is set
> to display UTF-8 it will be shown correctly.
>
> You can in worst case use utf_decode()/utf_encode()
>
> --
>
> //Aho

Yes it is all down to character encoding and php's bad support for
utf8, you have to work quite hard to make sure that utf8 is used in
all the places where
php is run
rendering takes place
data transfer (php<->database, php<->browser
data storage

you can set the browser display using
header( 'Content-Type: text/html; charset=utf8' );

you must be aware that most php function are not utf8 aware, you have
to be careful which ones you use, and where there are no mb_
(multibyte) equivalents you must seek to set them to be utf8 aware, if
you can't you cannot use them, unless you are prepared then to convert
back at the earliest point.

The data transport between mysql and php never uses utf8, you have to
force that (fake it) to (mysql connection collation utf-8 unicode
utf8)
make sure your mysql databases, tables, and individual fields are
using the right character sets.

On top of this, make sure that you edit those utf8 docs in a utf8
editor.

Fun isn't it. Do all that, and make it a habit, and you'll be fine.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация