Re: Creating a UTF-8 web page

[email protected] (Eric Cholet)
Newsgroups perl.unicode
Message-ID <[email protected]>
Le 7 avr. 04, à 09:21, Octavian Rasnita a écrit :

> Hi all,
>
> Please tell me if there is a way to create a web page encoded as UTF-8 
> (like
> Google's page) using perl.
>
> I have tried more modules but without success.
> The UTF-8 string is created fine (I think) but I don't know how to 
> print
> those 3 special characters at the beginning of the file for letting the
> browser know that it is UTF-8 encoded. If I just put "UTF-8" charset 
> in the
> HTTP or HTML header, the browser knows that is UTF-8 encoded, but each 
> bit
> is printed, and not each UTF-8 character.

You don't need a BOM (I assume that's what you mean by "those 3 special 
characters").
A HTTP header is sufficient, e.g.:

   Content-Type: text/html; charset=UTF-8

Be aware that this will override any charset setting in the HTML's META 
tag.

> And I see that I cannot view that web page with an editor like Notepad.

Caveat: I don't know Notepad, but this applies to any software:
Maybe Notepad doesn't know how to display UTF-8, or possibly
it does but you need to tell it what encoding the file is in,
a lot of programs use a default encoding such as ISO-8859-1 when
opening a file.

> Do you have any idea how can I create a page like Google's?
>
> Thank you.
>
> Teddy
>
--
Eric Cholet
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.