<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40058 >

> [jdorje - Tue Jan 29 02:02:12 2008]:
> 
> Patch is fine but the comment is a bit misleading - generally the
> returned value is passed off to GTK which wants it in UTF-8 (aka the
> internal encoding).  When used in the server this may not be the case.

Hence my previous suggestion that there could be mystrerror (no
re-encode) and mystrerror_utf8 (or with some other descriptive
suffix). The former to be used e.g. in the the server where the
error messages are generally printed to the console, and the
latter for gtk or other libraries that expect only utf8.

> 
> A similar patch should then work for the strsockerror function.

What I did for the warclient codebase is to factor out the common
code from mystrerror and mystrsocketerror (really only one line
difference between the two functions) into a helper function
get_errno_string(bool is_socket_error) (if you really really want to
see: http://svn.gna.org/viewcvs/freeciv-warclient?rev=983&view=rev).

I do wonder now if I was not a bit hasty in that by making the return
value of mystr*error always in internal encoding (i.e. utf8), there
might now be "garbage" strings appearing in server error messages
printed to the console for systems that do not expect utf8 in that
place...

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to