Gossamer Forum
Quote Reply
Charset
I want to add a few "if" statements into my category template to determine what character set is needed to display the text properly. I'm not that versed in Perl, and just need to know the syntax. For example:

if [the category name begins with World/Korean]
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-KR">
end if

if [the category name begins World/Russian]
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=KOI8-R">
end if

etc......

What I wish to accomplish by this, is to add the correct meta line to every category under World/Korean, World/Russian, etc. Any help would be much appreciated...

Sean
Quote Reply
Re: [SeanP] Charset In reply to
Another relatively easier approach would be to add a column called Language in the Category table.

You can have this be a db_select_field, by listing the languages in the db_select_field hash.

Then you would simply use the following conditional statements in your category.html file:

Code:

<%if Language eq 'Korean'%>
META TAG FOR KOREAN
<%endif%>
<%if Language eq 'Russian'%>
META TAG FOR RUSSIAN
<%endif%>


The problem with the approach you want to take which is to add conditional statements based on regexp of the category name, it would increase building time and you would have to use a lot more codes (by creating a global tag)...which is time-consuming and prone to high level of user error.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Chewbaca] Charset In reply to
That sounds like a good idea...

I created a new column in my Category table named "Language" and set it to varchar 255. Then, I used the following statements:

UPDATE Category SET Language = 'Russian' WHERE Full_Name LIKE 'World/Russian%';
UPDATE Category SET Language = 'Korean' WHERE Full_Name LIKE 'World/Korean%';

I will continue to update the fields as needed so that all of my foreign categories have the proper character set.

Thanks so much for the advice!

Sean

Last edited by:

SeanP: Oct 28, 2001, 8:47 PM
Quote Reply
Re: [SeanP] Charset In reply to
You're welcome.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Chewbaca] Charset In reply to
Here is a list of the meta lines from the World subcategories on http://dmoz.org if anyone needs them:


Afrikaans
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Arabic
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1256">

Armenian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ARMSCII-8">

Azerbaijani
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

Bahasa Melayu
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Bangla
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

Belarusian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=KOI8-F">

Bosnian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

Bulgarian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset="ARRAY(0X421AD4)">

Català
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Chinese Simplified
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=GB2312">

Chinese Traditional
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">

Croatian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Cymraeg
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Czech
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

Dansk
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Deutsch
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Eesti
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

Español
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Esperanto
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-3">

Euskara
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Faroese
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Farsi
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

Français
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Frysk
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Gaeilge
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Galego
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Greek
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1253">

Hebrew
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-8">

Hindi
[None]

Indonesia
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Interlingua
[None]

Islenska
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Italiano
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Japanese
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-JP">

Kiswahili
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

Korean
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-KR">

Latvian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

Lietuviu
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

Lingua Latina
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Lëtzebuergesch
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Magyar
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Marathi
[None]

Nederlands
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Norsk
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Polska
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Português
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Românã
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Rumantsch
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Russian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=KOI8-R">

Shqip
[None]

Íslenska
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Slovensko
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

Slovensky
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Srpski
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

Suomi
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Svenska
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Tagalog
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Taiwanese
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">

Tamil
[None]

Telugu
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

Thai
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=TIS-620">

Türkçe
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-9">

Ukrainian
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1251">

Vietnamese
[None]
Quote Reply
Re: [SeanP] Charset In reply to
Hi,

Another approach is to use like:

<%if Full_Name like 'World/Korean'%>
...
<%elsif Full_Name like 'World/Russian'%>
...
<%else%>
...
<%endif%>

Would do the trick.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Charset In reply to
In Reply To:
Hi,

Another approach is to use like:

<%if Full_Name like 'World/Korean'%>
...
<%elsif Full_Name like 'World/Russian'%>
...
<%else%>
...
<%endif%>

Would do the trick.

Cheers,

Alex

That is would propably be a bit easier. I used this in my category template before the </head> tag:

Code:
<%if Full_Name like 'World'%>


<%if Full_Name like 'World/Afrikaans'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Arabic'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1256">

<%elsif Full_Name like 'World/Armenian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ARMSCII-8">

<%elsif Full_Name like 'World/Bangla'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<%elsif Full_Name like 'World/Belarusian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=KOI8-F">

<%elsif Full_Name like 'World/Bosnian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

<%elsif Full_Name like 'World/Bulgarian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ARRAY(0X421AD4)">

<%elsif Full_Name like 'World/Català'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Chinese'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">

<%elsif Full_Name like 'World/Croatian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

<%elsif Full_Name like 'World/Cymraeg'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Czech'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

<%elsif Full_Name like 'World/Dansk'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Deutsch'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Eesti'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

<%elsif Full_Name like 'World/Español'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Esperanto'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-3">

<%elsif Full_Name like 'World/Euskara'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Faroese'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Farsi'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<%elsif Full_Name like 'World/Français'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Frysk'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Gaeilge'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Galego'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Greek'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1253">

<%elsif Full_Name like 'World/Hebrew'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-8">

<%elsif Full_Name like 'World/Hindi'%>

<%elsif Full_Name like 'World/Indonesia'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Íslenska'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Italiano'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Japanese'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-JP">

<%elsif Full_Name like 'World/Kiswahili'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<%elsif Full_Name like 'World/Korean'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-KR">

<%elsif Full_Name like 'World/Latvian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

<%elsif Full_Name like 'World/Lëtzebuergesch'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Lietuviu'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1257">

<%elsif Full_Name like 'World/Lingua Latina'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Magyar'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

<%elsif Full_Name like 'World/Malaysian'%>

<%elsif Full_Name like 'World/Marathi'%>

<%elsif Full_Name like 'World/Nederlands'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Norsk'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Polska'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

<%elsif Full_Name like 'World/Português'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Românã'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

<%elsif Full_Name like 'World/Rumantsch'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Russian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=KOI8-R">

<%elsif Full_Name like 'World/Serbian'%>

<%elsif Full_Name like 'World/Shqip'%>

<%elsif Full_Name like 'World/Simplified Chinese'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=GB2312">

<%elsif Full_Name like 'World/Slovensko'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1250">

<%elsif Full_Name like 'World/Slovensky'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-2">

<%elsif Full_Name like 'World/Suomi'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Svenska'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Tagalog'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Taiwanese'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">

<%elsif Full_Name like 'World/Tamil'%>

<%elsif Full_Name like 'World/Telugu'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<%elsif Full_Name like 'World/Thai'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=TIS-620">

<%elsif Full_Name like 'World/Türkçe'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-9">

<%elsif Full_Name like 'World/Ukrainian'%>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1251">

<%endif%>

<%endif%>

Thanks,
Sean
Quote Reply
Re: [SeanP] Charset In reply to
<%elsif Full_Name like 'World/Bulgarian'%><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ARRAY(0X421AD4)">
Quote Reply
Re: [RedRum] Charset In reply to
In Reply To:
<%elsif Full_Name like 'World/Bulgarian'%><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ARRAY(0X421AD4)">

May I just say... DOH!

The correct line for Bulgarian would be:

Code:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">

In fact, the Bulgarian categories on the Open directory have incorrect meta lines on them. That's where I got those...

Sean