Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Problems with danish char in database

From: Andy Dingley <dingbat@----------.--->
To: NULL
Date: 4/2/2008 11:32:00 AM
On 2 Apr, 14:05, "Tine M=FCller" <ti...@email.dk> wrote:
> Can someone help me what code to change so it's functioning with danish ch=
ar
> which is in the database?

I had a good answer, but the accursed Google Groups interface ate it
8-(

Lose the <meta> in your page. You're sending a HTTP-Header too (better
idea anyway) and that will take precedence.  As the page is claiming
to be UTF-8, then you'd better send UTF-8 / Unicode characters in it,
not ISO-8859 characters. If your DB is working in ISO-8859 already,
then you might find it easier to change the page generation code to
send the right HTTP header.

Read up (Wikipedia is good) on Unicode, ISO-8859 and the distinctions
between "character sets" (lists of squiggles that humans use) and
"character encoding" (sequences of bytes that computers use to refer
to these squiggles).

You _must_ use a character set that includes the squiggle you need.
Danish is easy (commonplace ISO-8859-1 suffices), Czech or Polish is
harder. In general these days, go straight to Unicode. This works for
all languages at once, ISO-8859 requires you to swap between
ISO-8859-1 and ISO-8859-4 depending on which side of the Baltic you
are.

You then need an encoding that works for the character set you use and
is configured so that your DB content matches your page (or gets
translated) and your page's header matches your page's content. Use
UTF-8 for Unicode, use the relevant ISO-8859-* for ISO-8859 (and you
would have to swap between sides of the Baltic).


Alternatively (a very bad idea, I only mention it to save a follow-up
pinhead doing so), use plain old ASCII as an encoding and HTML numeric
character entities or HTML entity references. You will find that
numeric character entities are no easier to generate than UTF-8 (if
your DB contains ISO-8859) and that entity references are a big chunk
of tedious look-up code to create (maybe a PHP library exists for
this). This approach is tedious, but it does work in cases where you
can't fix the web server's HTTP-Headers to indicate a correct or
useful encoding.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent