Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Spanish language category (¡Español!)

Quote Reply
Spanish language category (¡Español!)
I am attempting to create one category in Links 2 that is titled "¡Español!". This is part of the Oregon Association for Bilingual Education site.

I keep getting "Name (Invalid format)"

I have tried ¡Español! with the same result.

Is there any way around this? Will I run into the same problem with diacritical marks throughout this section when I go to post links?

Thanks.

Charlie Bauer

ELL / Migrant Education Coordinator
Southern Oregon Education Service District
Quote Reply
Re: [Carlitos] Spanish language category (¡Español!) In reply to
Yes, you will. Links will only accept normal english letters for category names, since they become part of the url, too. This should be easy enough to fix, though. Try adding this to the db_utils.pl file:

sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g;
$toencode =~ s/ñ/n/g;
return $toencode;
}

This will change your ñ into a plain ol' n for use in the URL, but still use the tilde version in the category name. You will also need to change this in the category.pl file:

# Database Definition: CATEGORIES
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-\c&\c;]+$'],

That should let you use the & and ; in the category name. I don't guarantee this fix, but I think it'll work.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Spanish language category (¡Español!) In reply to
Oops, you need to change this in nph-build.cgi, too (last routine in the file):


sub build_check_dir {
# --------------------------------------------------------
# Checks the directory before we create it to make sure there
# are no funncy characters in it.
my ($root, $dir) = @_;
my $chrs = quotemeta ("/_-");

if (! -e $root) {
&cgierr ("Root directory: $root does not exist!");
}
if ($dir !~ m,^[\c&\c;\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, _, / and -.");
}
return $input;
}


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Spanish language category (�Espa�ol!) In reply to
Thanks! I will try it out.
Charlie Bauer

ELL / Migrant Education Coordinator
Southern Oregon Education Service District