If you are registering MLDs, then you may have noticed problems if you do
not set the character set in HTML as the registration progresses. IE in
particular will "start over" (go back to the /reg_system.cgi without
variable information) if you try to change the character set during the
order process. So what you want to do if you are offering MLDs is to set the
character set in the html, not by forcing the user to choose in the browser.

We also noticed that it is a bad thing to use a stylesheet which specifies
English language fonts, they could override your desired settings and make a
native language term appear incorrectly on the screen. So this script sets a
different stylesheet depending on the MLD type. If you don't use
stylesheets, then you can remove the stylesheet lines.

Here are some mods which will allow you to have the character set defined
for each mld type, and for a different stylesheet for each mld type.

Try it out at our domain registration site at
http://www.rackshare.com/domain/ to see what I am talking about. Click on
one of the MLD types, and then View Source to see what stylesheet/charset is
set in the browser.

Here's how you can do this:

1) If you use stylesheets, this script allows for 4 stylesheets, one each
for English, Japanese, Korean, and Chinese registrations.

We assume they are at:

/default.css
/default_jp.css
/default_kr.css
/default_zh.css

In our case, the stylesheets are identical except we do not have font face
information in the non-English ones. For that reason, we are not
differentiating between simplified or traditional Chinese.

2) Add the following HTML to your base.html template in the HEAD tags:

<META http-equiv="Content-Type" content="text/html;charset={{newcharset}}">
{{stylesheet}}

3) Add this sub-routine somewhere in your reg_system.cgi, maybe underneath
the createMLDNSHTMLLink sub (from which this hack is derived):

sub makeCustomHTML
{
    my $HTML    = shift;
    my ($newcharset, $newlang, $stylesheet);
    
    if ($in{encoding_type} eq "shift-jis") {
    $stylesheet = "<link rel=stylesheet href=\"/default_jp.css\"
type=\"text/css\">";
    $HTML->{stylesheet} = $stylesheet;
    $newcharset = "shift_jis";
    $newlang = "ja";
    $HTML->{newlang} = $newlang;
    $HTML->{newcharset} = $newcharset;
    }
    elsif ($in{encoding_type} eq "ksc5601-1992") {
    $stylesheet = "<link rel=stylesheet href=\"/default_kr.css\"
type=\"text/css\">";
    $HTML->{stylesheet} = $stylesheet;
    $newcharset = "euc-kr";
    $newlang = "kr";
    $HTML->{newlang} = $newlang;
    $HTML->{newcharset} = $newcharset;
    }
    elsif ($in{encoding_type} eq "") {
    $stylesheet = "<link rel=stylesheet href=\"/default.css\"
type=\"text/css\">";
    $HTML->{stylesheet} = $stylesheet;
    $newlang = "en";
    $HTML->{newlang} = $newlang;
    $newcharset = "iso-8859-1";
    $HTML->{newcharset} = $newcharset;
    }
    else {
    $stylesheet = "<link rel=stylesheet href=\"/default_zh.css\"
type=\"text/css\">";
    $HTML->{stylesheet} = $stylesheet;
    $newcharset = $in{encoding_type};
    $newlang = "zh";
    $HTML->{newlang} = $newlang;
    $HTML->{newcharset} = $newcharset;
    }
}

Note that the above surely wrapped in my email client, there should only be
a space after the last " on the lines with $stylesheet, the type= stuff
should follow directly after, not go on the next line.

4) Then add this:

makeCustomHTML (\%HTML);

to all the subroutines used to process an order:

main_menu
lookup
setup_profile
do_setup_profile
register

Maybe there are others I missed? I am not processing bulk orders, so I don't
know how this will work with bulk regs.

Yes, there is one extra variable in there, $newlang. I think it may be
possible to use something like <P lang="{{newlang}}"> in your HTML to have
elements assume a separate character set. This might be useful if you are
registering domains in Japanese, for example, but want only parts of a page
to display in the language of the mld. In this case you would want to remove
the {{newcharset}} part in your template, since you would be setting the
language only in certain elements of the page, not for the whole page.

Hope someone finds this useful. Please send comments/feedback to this list.

-- 
John Keegan
[EMAIL PROTECTED]
http://RackShare.com


Reply via email to