<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40043 >
On Thu, 24 Jan 2008 William Allen Simpson wrote:
> Egor Vyscrebentsov wrote:
> > At least in utility/shared.c:wordwrap_string() strlen() is used to
> > determine number of characters in the string. This gives wrong result
> > on multibytes encoding.
> The issue is not strlen(). It is properly used to determine the
> length of a string. The issue is that strlen() has nothing to do with
> how much room there is for display in a particular window!
>From what I can see everyday, you're wrong. strlen() will return 70,
while there are only, say, 40 multibyte characters. And you can't say
that you have 160 char on 80-characters ru_RU.UTF-8 line. strlen()
couldn't be used here. (I say this as one of ALT Linux developer.
Unfortunately, most of bugs in our bugzilla are in russian, so it
will not help me to show you this... Please, believe me there are
a couple of [confirmed] bugs caused by usage of strlen.)
strlen() may be used to get size of string, but not length.
> This abuse of strlen() would have been considered a stupid bug as far
> back as the techtronix green screen in the '70s!!! Or the DECwriters we
> all used for C programming back then. Let alone modern i18n....
> The messages should be wrapped in the clients by their respective GUI code,
> such as gtk-text-set-word-wrap, XawtextWrapWord, etc.
Please note that I have mentioned server console. What should we use there?
> I propose removing wordwrap_string() everywhere.
I disagree. However, I agree that we should not use this function for
GUI clients. But it seems to me that you say about other problem than me.
Freeciv-dev mailing list