source: introduction/important/locale-issues.xml@ 51b61f4

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 51b61f4 was 51b61f4, checked in by Bruce Dubbs <bdubbs@…>, 4 years ago

Comment out psutils and a2ps

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@22889 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 13.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="locale-issues" xreflabel="Locale Related Issues">
9 <?dbhtml filename="locale-issues.html"?>
10
11 <sect1info>
12 <othername>$LastChangedBy$</othername>
13 <date>$Date$</date>
14 </sect1info>
15
16 <title>Locale Related Issues</title>
17
18 <para>This page contains information about locale related problems and
19 issues. In the following paragraphs you'll find a generic overview of
20 things that can come up when configuring your system for various locales.
21 Many (but not all) existing locale related problems can be classified
22 and fall under one of the headings below. The severity ratings below use
23 the following criteria:</para>
24
25 <itemizedlist>
26 <listitem>
27 <para>Critical: The program doesn't perform its main function.
28 The fix would be very intrusive, it's better to search for a
29 replacement.</para>
30 </listitem>
31 <listitem>
32 <para>High: Part of the functionality that the program provides
33 is not usable. If that functionality is required, it's better to
34 search for a replacement.</para>
35 </listitem>
36 <listitem>
37 <para>Low: The program works in all typical use cases, but lacks
38 some functionality normally provided by its equivalents.</para>
39 </listitem>
40 </itemizedlist>
41
42 <para>If there is a known workaround for a specific package, it will
43 appear on that package's page. For the most recent information
44 about locale related issues for individual packages, check the
45 <ulink url="&blfs-wiki;/BlfsNotes">User Notes</ulink> in the BLFS
46 Wiki.</para>
47
48 <sect2 id="locale-not-valid-option"
49 xreflabel="Needed Encoding Not a Valid Option">
50
51 <title>The Needed Encoding is Not a Valid Option in the Program</title>
52
53 <para>Severity: Critical</para>
54
55 <para>Some programs require the user to specify the character encoding
56 for their input or output data and present only a limited choice of
57 encodings. This is the case for the <option>-X</option> option in
58<!-- <xref linkend="a2ps"/> and --><xref linkend="enscript"/>,
59 the <option>-input-charset</option> option in unpatched
60 <xref linkend="cdrtools"/>, and the character sets offered for display
61 in the menu of <xref linkend="Links"/>. If the required encoding is not
62 in the list, the program usually becomes completely unusable. For
63 non-interactive programs, it may be possible to work around this by
64 converting the document to a supported input character set before
65 submitting to the program.</para>
66
67 <para>A solution to this type of problem is to implement the necessary
68 support for the missing encoding as a patch to the original program or to
69 find a replacement.</para>
70
71 </sect2>
72
73 <sect2 id="locale-assumed-encoding"
74 xreflabel="Program Assumes Encoding">
75
76 <title>The Program Assumes the Locale-Based Encoding of External
77 Documents</title>
78
79 <para>Severity: High for non-text documents, low for text
80 documents</para>
81
82 <para>Some programs, <xref linkend="nano"/> or
83 <xref linkend="joe"/> for example, assume that documents are always
84 in the encoding implied by the current locale. While this assumption
85 may be valid for the user-created documents, it is not safe for
86 external ones. When this assumption fails, non-ASCII characters are
87 displayed incorrectly, and the document may become unreadable.</para>
88
89 <para>If the external document is entirely text based, it can be
90 converted to the current locale encoding using the
91 <command>iconv</command> program.</para>
92
93 <para>For documents that are not text-based, this is not possible.
94 In fact, the assumption made in the program may be completely
95 invalid for documents where the Microsoft Windows operating system
96 has set de facto standards. An example of this problem is ID3v1 tags
97 in MP3 files (see the <ulink url="&blfs-wiki;/ID3v1Coding">BLFS Wiki
98 ID3v1Coding page</ulink>
99 for more details). For these cases, the only solution is to find a
100 replacement program that doesn't have the issue (e.g., one that
101 will allow you to specify the assumed document encoding).</para>
102
103 <para>Among BLFS packages, this problem applies to
104 <xref linkend="nano"/>, <xref linkend="joe"/>, and all media players
105 except <xref linkend="audacious"/>.</para>
106
107 <para>Another problem in this category is when someone cannot read
108 the documents you've sent them because their operating system is
109 set up to handle character encodings differently. This can happen
110 often when the other person is using Microsoft Windows, which only
111 provides one character encoding for a given country. For example,
112 this causes problems with UTF-8 encoded TeX documents created in
113 Linux. On Windows, most applications will assume that these documents
114 have been created using the default Windows 8-bit encoding.
115 </para>
116
117 <para>In extreme cases, Windows encoding compatibility issues may be
118 solved only by running Windows programs under
119 <ulink url="http://www.winehq.com/">Wine</ulink>.</para>
120
121 </sect2>
122
123 <sect2 id="locale-wrong-filename-encoding"
124 xreflabel="Wrong Filename Encoding">
125
126 <title>The Program Uses or Creates Filenames in the Wrong Encoding</title>
127
128 <para>Severity: Critical</para>
129
130 <para>The POSIX standard mandates that the filename encoding is
131 the encoding implied by the current LC_CTYPE locale category. This
132 information is well-hidden on the page which specifies the behavior
133 of <application>Tar</application> and <application>Cpio</application>
134 programs. Some programs get it wrong by default (or simply don't
135 have enough information to get it right). The result is that they
136 create filenames which are not subsequently shown correctly by
137 <command>ls</command>, or they refuse to accept filenames that
138 <command>ls</command> shows properly. For the <xref linkend="glib2"/>
139 library, the problem can be corrected by setting the
140 <envar>G_FILENAME_ENCODING</envar> environment variable to the special
141 "@locale" value. <application>Glib2</application> based programs that
142 don't respect that environment variable are buggy.</para>
143
144 <para>The <xref linkend="zip"/> and <xref linkend="unzip"/> have this
145 problem because they hard-code the expected filename encoding.
146 <application>UnZip</application> contains a hard-coded conversion table
147 between the CP850 (DOS) and ISO-8859-1 (UNIX) encodings and uses this table
148 when extracting archives created under DOS or Microsoft Windows. However,
149 this assumption only works for those in the US and not for anyone using a
150 UTF-8 locale. Non-ASCII characters will be mangled in the extracted
151 filenames.</para>
152
153 <!--<para>On the other hand,
154 <application>Nautilus CD Burner</application> checks names of
155 files added to its window for UTF-8 validity. This is wrong for
156 users of non-UTF-8 locales. Also,
157 <application>Nautilus CD Burner</application> unconditionally
158 calls <command>mkisofs</command> with the
159 <parameter>-input-charset UTF-8</parameter> parameter, which is
160 only correct in UTF-8 locales.</para>-->
161
162 <para>The general rule for avoiding this class of problems is to
163 avoid installing broken programs. If this is impossible, the
164 <ulink url="http://j3e.de/linux/convmv/">convmv</ulink>
165 command-line tool can be used to fix filenames created by these
166 broken programs, or intentionally mangle the existing filenames
167 to meet the broken expectations of such programs.</para>
168
169 <para>In other cases, a similar problem is caused by importing
170 filenames from a system using a different locale with a tool that
171 is not locale-aware (e.g., <!--<xref linkend="nfs-utils"/> or-->
172 <xref linkend="openssh"/>). In order to avoid mangling non-ASCII
173 characters when transferring files to a system with a different
174 locale, any of the following methods can be used:</para>
175
176 <itemizedlist>
177 <listitem>
178 <para>Transfer anyway, fix the damage with
179 <command>convmv</command>.</para>
180 </listitem>
181 <listitem>
182 <para>On the sending side, create a tar archive with the
183 <parameter>--format=posix</parameter> switch passed to
184 <command>tar</command> (this will be the default in a future
185 version of <command>tar</command>).</para>
186 </listitem>
187 <listitem>
188 <para>Mail the files as attachments. Mail clients specify the
189 encoding of attached filenames.</para>
190 </listitem>
191 <listitem>
192 <para>Write the files to a removable disk formatted with a FAT or
193 FAT32 filesystem.</para>
194 </listitem>
195 <listitem>
196 <para>Transfer the files using Samba.</para>
197 </listitem>
198 <listitem>
199 <para>Transfer the files via FTP using RFC2640-aware server
200 (this currently means only wu-ftpd, which has bad security history)
201 and client (e.g., lftp).</para>
202 </listitem>
203 </itemizedlist>
204
205 <para>The last four methods work because the filenames are automatically
206 converted from the sender's locale to UNICODE and stored or sent in this
207 form. They are then transparently converted from UNICODE to the
208 recipient's locale encoding.</para>
209
210 </sect2>
211
212 <sect2 id="locale-wrong-multibyte-characters"
213 xreflabel="Breaks Multibyte Characters">
214
215 <title>The Program Breaks Multibyte Characters or Doesn't Count
216 Character Cells Correctly</title>
217
218 <para>Severity: High or critical</para>
219
220 <para>Many programs were written in an older era where multibyte
221 locales were not common. Such programs assume that C "char" data
222 type, which is one byte, can be used to store single characters.
223 Further, they assume that any sequence of characters is a valid
224 string and that every character occupies a single character cell.
225 Such assumptions completely break in UTF-8 locales. The visible
226 manifestation is that the program truncates strings prematurely
227 (i.e., at 80 bytes instead of 80 characters). Terminal-based
228 programs don't place the cursor correctly on the screen, don't react
229 to the "Backspace" key by erasing one character, and leave junk
230 characters around when updating the screen, usually turning the
231 screen into a complete mess.</para>
232
233 <para>Fixing this kind of problems is a tedious task from a
234 programmer's point of view, like all other cases of retrofitting new
235 concepts into the old flawed design. In this case, one has to redesign
236 all data structures in order to accommodate to the fact that a complete
237 character may span a variable number of "char"s (or switch to wchar_t
238 and convert as needed). Also, for every call to the "strlen" and
239 similar functions, find out whether a number of bytes, a number of
240 characters, or the width of the string was really meant. Sometimes it
241 is faster to write a program with the same functionality from scratch.
242 </para>
243
244 <para>Among BLFS packages, this problem applies to
245 <xref linkend="xine-ui"/> and all the shells.</para>
246
247 </sect2>
248
249 <sect2 id="locale-wrong-manpage-encoding"
250 xreflabel="Incorrect Manual Page Encoding">
251
252 <title>The Package Installs Manual Pages in Incorrect or
253 Non-Displayable Encoding</title>
254
255 <para>Severity: Low</para>
256
257 <para>LFS expects that manual pages are in the language-specific (usually
258 8-bit) encoding, as specified on the <ulink
259 url="&lfs-root;/chapter06/man-db.html">LFS Man DB page</ulink>. However,
260 some packages install translated manual pages in UTF-8 encoding (e.g.,
261 Shadow, already dealt with), or manual pages in languages not in the table.
262 Not all BLFS packages have been audited for conformance with the
263 requirements put in LFS (the large majority have been checked, and fixes
264 placed in the book for packages known to install non-conforming manual
265 pages). If you find a manual page installed by any of BLFS packages that is
266 obviously in the wrong encoding, please remove or convert it as needed, and
267 report this to BLFS team as a bug.</para>
268
269 <para>You can easily check your system for any non-conforming manual pages
270 by copying the following short shell script to some accessible location,
271
272<screen><literal>#!/bin/sh
273# Begin checkman.sh
274# Usage: find /usr/share/man -type f | xargs checkman.sh
275for a in "$@"
276do
277 # echo "Checking $a..."
278 # Pure-ASCII manual page (possibly except comments) is OK
279 grep -v '.\\"' "$a" | iconv -f US-ASCII -t US-ASCII >/dev/null 2>&amp;1 \
280 &amp;&amp; continue
281 # Non-UTF-8 manual page is OK
282 iconv -f UTF-8 -t UTF-8 "$a" >/dev/null 2>&amp;1 || continue
283 # Found a UTF-8 manual page, bad.
284 echo "UTF-8 manual page: $a" >&amp;2
285done
286# End checkman.sh
287</literal></screen>
288
289 and then issuing the following command (modify the command below if the
290 <command>checkman.sh</command> script is not in your <envar>PATH</envar>
291 environment variable):</para>
292
293<screen><userinput>find /usr/share/man -type f | xargs checkman.sh</userinput></screen>
294
295 <para>Note that if you have manual pages installed in any location other
296 than <filename class='directory'>/usr/share/man</filename> (e.g.,
297 <filename class='directory'>/usr/local/share/man</filename>), you must
298 modify the above command to include this additional location.</para>
299
300 </sect2>
301
302</sect1>
Note: See TracBrowser for help on using the repository browser.