Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] Re: (PR#9995) RfP: is_sane_name and user names
Home

[Freeciv-Dev] Re: (PR#9995) RfP: is_sane_name and user names

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9995) RfP: is_sane_name and user names
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 9 Sep 2004 17:40:40 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9995 >

Per I. Mathisen wrote:

>>>It is called on city and player names.
>>
>>But this is also a bug. Non-ascii city and player names are supposed to
>>be allowed, and where do you draw the line?
> 
> Am I mistaken, or did you just commit a patch that outlawed a large
> portion of the city names in our nation rulesets?

You're not mistaken.  However there is more to it.  This function 
checked to see if the characters were valid latin1.  However it is given 
strings that are in the internal encoding...which is (since the utf-8 
patch) utf8 in the server, and could be anything in the client.  Thus 
the function was already garbage and likely to fail.  (Nobody noticed it 
because I committed the two patches just a minute or two apart.)

Note this function is called from both server and client.  If we want to 
extend it to non-ascii characters we need to call 
internal_to_unicode_string() to convert the string into UCS-4, and work 
with that.

> This is related to cheating. Making rubbish city names help confuse the
> enemy and make cooperation among allies difficult. Naming all your cities
> the same or seemingly the same will hide your capital. If you name all
> your cities in chinese characters, then it will be hard for your european
> player enemy to find both your capital and coordinate attacks, or even
> remember the city where you last lost a unit.
> 
> Even so, I think UTF-8 city names should be allowed. And as long as we
> have those stupid leaders names, they should also be fully supported as
> UTF-8. Usernames should always be in ASCII.

Some UTF-8 characters should be allowed.  But where do you draw the 
line?  And what about someone who uses a completely different alphabet? 
  It might make sense to limit everything to ASCII, but this is very 
Eurocentric.  A Japanese player would probably want to use Japanese 
characters for his cities.  This shouldn't be allowed on pubserver 
(which is understandably Eurocentric), but it should be for 
single-player or all-Japanese games.

It is easy to make a list of allowed characters.  This could be in the 
ruleset or even listed per-nation.  Although this still leaves the 
problem of where you draw the line.

In the patch attached to this ticket I draw the line in a simple way: 
names from the ruleset are always allowed, otherwise only ascii is 
allowed.  This allows the Japanese players to use a specialized Japanese 
ruleset and get by okay.  But it still has some drawbacks.

I think is_ascii_name should be further restricted however.  Currently 
it blanketly allows almost all ascii characters, with just a few 
exceptions.  I think only a-zA-Z, plus ' ', '_', and '-', should be 
allowed.  (Perhaps I'm missing a character or two that should be 
allowed.  Nonetheless I think the function violates the safety rule that 
you always list what is allowed, rather than what isn't.)

jason




[Prev in Thread] Current Thread [Next in Thread]