~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to utility/fciconv.h

  • Committer: Package Import Robot
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2011-08-28 22:40:00 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: package-import@ubuntu.com-20110828224000-j2r1erewlem25dox
Tags: 2.3.0-1
[ Karl Goetz ]
* New upstream version.
* Fix themes_sdl_use_system_fonts.diff to apply cleanly on 2.3.0
* Massage work_around_unity_induced_breakage.diff to get it
  applying to the new codebase (The patch assumes commits made
  after 2.3.0 was tagged upstream).

[ Clint Adams ]
* Fudge build system to think there is no libtool mismatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "shared.h"
19
19
 
 
20
/*
 
21
  Technical details:
 
22
 
 
23
  - There are three encodings used by freeciv: the data encoding, the
 
24
    internal encoding, and the local encoding.  Each is a character set
 
25
    (like utf-8 or latin1).  Each string in the code must be in one of these
 
26
    three encodings; to cut down on bugs always document whenever you have
 
27
    a string in anything other than the internal encoding and never make
 
28
    global variables hold anything other than the internal encoding; the
 
29
    local and data encodings should only be used locally within the code
 
30
    and always documented as such.
 
31
 
 
32
  - The data_encoding is used in all data files and network transactions.
 
33
    This is always UTF-8.
 
34
 
 
35
  - The internal_encoding is used internally within freeciv.  This is always
 
36
    UTF-8 at the server, but can be configured by the GUI client.  The GTK2
 
37
    client uses UTF-8 here but other clients will use whatever their GUI
 
38
    library or platform requires.  By using the GUI encoding internally at
 
39
    the client it allows us to pass any strings directly to the GUI without
 
40
    needing to convert them.  The drawback is that we have to convert them
 
41
    into the data encoding before sending them over the network (a likely
 
42
    source of bugs).  Also, gettext is set up to always return strings in
 
43
    the internal encoding.
 
44
 
 
45
  - The local_encoding is the one supported on the command line, which is
 
46
    generally the value listed in the $LANG environment variable.  This is
 
47
    not under freeciv control; all output to the command line must be
 
48
    converted or it will not display correctly.
 
49
 
 
50
  Practical details:
 
51
 
 
52
  - Translation files are not controlled by freeciv iconv.  The .po files
 
53
    can be in any character set, as set at the top of the file.
 
54
 
 
55
  - All translatable texts should be American English ASCII. In the past,
 
56
    gettext documentation has always said to stick to ASCII for the gettext
 
57
    input (pre-translated texts) and rely on translations to supply the
 
58
    needed non-ASCII characters.
 
59
 
 
60
  - All other texts, including rulesets, nations, and code files must be in
 
61
    UTF-8 (ASCII is a subset of UTF-8, and is fine for use here).
 
62
 
 
63
  - The server uses UTF-8 for everything; UTF-8 is the server's "internal
 
64
    encoding".
 
65
 
 
66
  - Everything sent over the network is always in UTF-8.
 
67
 
 
68
  - Everything in the client is converted into the client's "internal
 
69
    encoding" when it is received from the server.  Depending on which
 
70
    GUI is used, this may be just about any character set.  Conversely when
 
71
    sending strings from the client to the server they need to be converted
 
72
    into the data encoding.  This should be done internally within the
 
73
    network code.
 
74
 
 
75
  - Everything printed to the command line must be converted into the
 
76
    "local encoding" which may be anything as defined by the system.  Using
 
77
    fc_fprintf is generally the easiest way to print to the command line
 
78
    in which case all strings passed to it should be in the internal
 
79
    encoding.
 
80
 
 
81
  See PR#40028 in the old RT for additional explanation.
 
82
*/
 
83
 
20
84
#define FC_DEFAULT_DATA_ENCODING "UTF-8"
21
85
 
22
86
void init_character_encodings(const char *internal_encoding,