encoding.2da is used for language encoding UTF8 mappings. It is one of the few 2da files not included in the game files by default (leading to default engine behaviour).

This was added in the NWN:EE 1.87.8193.35 patch of the game.

2da Usage

A module can ship a custom encoding.2da file that just looks like:

2DA V2.0

       Codepoint
0      0x0
1      0x1
2      0x2
3      0x3
4      0x4
5      0x5
6      0x6
...

This specifies a mapping between UTF8 (Basic Multilingual Plane only, i.e. codepoints <=0xFFFF) and whatever internal game codepage is. The module would also need to ship an appropriate set of font files that contain the same symbols at values 0...255.

As an example, Turkish is not a supported language, and Turkish characters such as ğĞşŞ cannot be typed. However, the Turkish codepage (ISO 8859-9) is very similar to the English/western one (ISO 8859-1), except that it replaces Icelandic characters (ðÐþÞ) with Turkish ones.

For a module to support Turkish, they first modify the English font and make the ð glyph look like ğ. Then, in the encoding 2DA they change the line 240 from 0xF0 to 0x011F. Players then type the unicode symbol ğ into the chatbar, but it's remapped to ð instead; however, the font displays it as ğ, so the player is none the wiser. When it comes time to convert it to UTF8 the reverse mapping is done, so the UTF8 text remains the same.

Only drawback is if you dump the cp1252/ISO8859-1 text to a file somewhere and then open it with a different program, you'll get gibberish.

2da Columns

Column NamesExampleValid ValuesDescription and Notes
Codepoint0x1UTF8 codepage IDsSee usage above.

encoding.2da Unchanged example

This is the games original unchanged encoding.2da if it was included in the game files.

2DA V2.0

       Codepoint
0      0x0
1      0x1
2      0x2
3      0x3
4      0x4
5      0x5
6      0x6
7      0x7
8      0x8
9      0x9
10     0xa
11     0xb
12     0xc
13     0xd
14     0xe
15     0xf
16     0x10
17     0x11
18     0x12
19     0x13
20     0x14
21     0x15
22     0x16
23     0x17
24     0x18
25     0x19
26     0x1a
27     0x1b
28     0x1c
29     0x1d
30     0x1e
31     0x1f
32     0x20
33     0x21
34     0x22
35     0x23
36     0x24
37     0x25
38     0x26
39     0x27
40     0x28
41     0x29
42     0x2a
43     0x2b
44     0x2c
45     0x2d
46     0x2e
47     0x2f
48     0x30
49     0x31
50     0x32
51     0x33
52     0x34
53     0x35
54     0x36
55     0x37
56     0x38
57     0x39
58     0x3a
59     0x3b
60     0x3c
61     0x3d
62     0x3e
63     0x3f
64     0x40
65     0x41
66     0x42
67     0x43
68     0x44
69     0x45
70     0x46
71     0x47
72     0x48
73     0x49
74     0x4a
75     0x4b
76     0x4c
77     0x4d
78     0x4e
79     0x4f
80     0x50
81     0x51
82     0x52
83     0x53
84     0x54
85     0x55
86     0x56
87     0x57
88     0x58
89     0x59
90     0x5a
91     0x5b
92     0x5c
93     0x5d
94     0x5e
95     0x5f
96     0x60
97     0x61
98     0x62
99     0x63
100    0x64
101    0x65
102    0x66
103    0x67
104    0x68
105    0x69
106    0x6a
107    0x6b
108    0x6c
109    0x6d
110    0x6e
111    0x6f
112    0x70
113    0x71
114    0x72
115    0x73
116    0x74
117    0x75
118    0x76
119    0x77
120    0x78
121    0x79
122    0x7a
123    0x7b
124    0x7c
125    0x7d
126    0x7e
127    0x7f
128    0x20ac
129    0x81
130    0x201a
131    0x192
132    0x201e
133    0x2026
134    0x2020
135    0x2021
136    0x2c6
137    0x2030
138    0x160
139    0x2039
140    0x152
141    0x8d
142    0x17d
143    0x8f
144    0x90
145    0x2018
146    0x2019
147    0x201c
148    0x201d
149    0x2022
150    0x2013
151    0x2014
152    0x2dc
153    0x2122
154    0x161
155    0x203a
156    0x153
157    0x9d
158    0x17e
159    0x178
160    0xa0
161    0xa1
162    0xa2
163    0xa3
164    0xa4
165    0xa5
166    0xa6
167    0xa7
168    0xa8
169    0xa9
170    0xaa
171    0xab
172    0xac
173    0xad
174    0xae
175    0xaf
176    0xb0
177    0xb1
178    0xb2
179    0xb3
180    0xb4
181    0xb5
182    0xb6
183    0xb7
184    0xb8
185    0xb9
186    0xba
187    0xbb
188    0xbc
189    0xbd
190    0xbe
191    0xbf
192    0xc0
193    0xc1
194    0xc2
195    0xc3
196    0xc4
197    0xc5
198    0xc6
199    0xc7
200    0xc8
201    0xc9
202    0xca
203    0xcb
204    0xcc
205    0xcd
206    0xce
207    0xcf
208    0xd0
209    0xd1
210    0xd2
211    0xd3
212    0xd4
213    0xd5
214    0xd6
215    0xd7
216    0xd8
217    0xd9
218    0xda
219    0xdb
220    0xdc
221    0xdd
222    0xde
223    0xdf
224    0xe0
225    0xe1
226    0xe2
227    0xe3
228    0xe4
229    0xe5
230    0xe6
231    0xe7
232    0xe8
233    0xe9
234    0xea
235    0xeb
236    0xec
237    0xed
238    0xee
239    0xef
240    0xf0
241    0xf1
242    0xf2
243    0xf3
244    0xf4
245    0xf5
246    0xf6
247    0xf7
248    0xf8
249    0xf9
250    0xfa
251    0xfb
252    0xfc
253    0xfd
254    0xfe
255    0xff