Commit | Line | Data |
---|---|---|
eb1db76e LC |
1 | This hack makes Guile default to UTF-8. This avoids calls to |
2 | `iconv_open'; `iconv_open' tries to open shared objects that aren't | |
3 | available during bootstrap, so using UTF-8 avoids that (and UTF-8 has | |
4 | built-in conversions in glibc, too.) | |
5 | ||
6 | diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c | |
7 | index cf41f2f..facfb91 100644 | |
8 | --- a/libguile/bytevectors.c | |
9 | +++ b/libguile/bytevectors.c | |
10 | @@ -1887,7 +1887,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness) | |
11 | if (scm_i_is_narrow_string (str)) \ | |
12 | { \ | |
13 | err = mem_iconveh (scm_i_string_chars (str), c_strlen, \ | |
14 | - "ISO-8859-1", c_utf_name, \ | |
15 | + "UTF-8", c_utf_name, \ | |
16 | iconveh_question_mark, NULL, \ | |
17 | &c_utf, &c_utf_len); \ | |
18 | if (SCM_UNLIKELY (err)) \ | |
19 | diff --git a/libguile/ports.c b/libguile/ports.c | |
20 | index 301bc44..b0ea2e6 100644 | |
21 | --- a/libguile/ports.c | |
22 | +++ b/libguile/ports.c | |
23 | @@ -1750,7 +1750,7 @@ scm_ungetc (scm_t_wchar c, SCM port) | |
24 | if (pt->encoding != NULL) | |
25 | encoding = pt->encoding; | |
26 | else | |
27 | - encoding = "ISO-8859-1"; | |
28 | + encoding = "UTF-8"; | |
29 | ||
30 | len = sizeof (result_buf); | |
31 | result = u32_conv_to_encoding (encoding, | |
32 | @@ -2212,7 +2212,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding) | |
33 | pt = SCM_PTAB_ENTRY (port); | |
34 | ||
35 | if (encoding == NULL) | |
36 | - encoding = "ISO-8859-1"; | |
37 | + encoding = "UTF-8"; | |
38 | ||
39 | if (pt->encoding != encoding) | |
40 | pt->encoding = scm_gc_strdup (encoding, "port"); | |
41 | diff --git a/libguile/posix.c b/libguile/posix.c | |
42 | index 4f8b8ac..fea7f74 100644 | |
43 | --- a/libguile/posix.c | |
44 | +++ b/libguile/posix.c | |
45 | @@ -1740,7 +1740,7 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0, | |
46 | SCM_SYSERROR; | |
47 | } | |
48 | ||
49 | - enc = locale_charset (); | |
50 | + enc = "UTF-8"; | |
51 | ||
52 | /* Set the default encoding for new ports. */ | |
53 | scm_i_set_default_port_encoding (enc); | |
54 | diff --git a/libguile/script.c b/libguile/script.c | |
55 | index 83daf8a..083891e 100644 | |
56 | --- a/libguile/script.c | |
57 | +++ b/libguile/script.c | |
58 | @@ -387,7 +387,7 @@ locale_arguments_to_string_list (int argc, char **const argv) | |
59 | SCM lst; | |
60 | const char *encoding; | |
61 | ||
62 | - encoding = environ_locale_charset (); | |
63 | + encoding = "UTF-8"; | |
64 | for (i = argc - 1, lst = SCM_EOL; | |
65 | i >= 0; | |
66 | i--) | |
67 | diff --git a/libguile/strings.c b/libguile/strings.c | |
68 | index 5d0db23..8266247 100644 | |
69 | --- a/libguile/strings.c | |
70 | +++ b/libguile/strings.c | |
71 | @@ -1576,7 +1576,7 @@ scm_from_locale_string (const char *str) | |
72 | SCM | |
73 | scm_from_locale_stringn (const char *str, size_t len) | |
74 | { | |
75 | - return scm_from_stringn (str, len, locale_charset (), | |
76 | + return scm_from_stringn (str, len, "UTF-8", | |
77 | scm_i_default_port_conversion_handler ()); | |
78 | } | |
79 | ||
80 | @@ -1803,7 +1803,7 @@ char * | |
81 | scm_to_locale_stringn (SCM str, size_t *lenp) | |
82 | { | |
83 | return scm_to_stringn (str, lenp, | |
84 | - locale_charset (), | |
85 | + "UTF-8", | |
86 | scm_i_default_port_conversion_handler ()); | |
87 | } | |
88 | ||
89 | @@ -2054,7 +2054,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding, | |
90 | "string contains #\\nul character: ~S", | |
91 | scm_list_1 (str)); | |
92 | ||
93 | - if (scm_i_is_narrow_string (str) && (encoding == NULL)) | |
94 | + if (scm_i_is_narrow_string (str)) | |
95 | { | |
96 | /* If using native Latin-1 encoding, just copy the string | |
97 | contents. */ | |
98 | @@ -2079,11 +2079,11 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding, | |
99 | len = 0; | |
100 | enc = encoding; | |
101 | if (enc == NULL) | |
102 | - enc = "ISO-8859-1"; | |
103 | + enc = "UTF-8"; | |
104 | if (scm_i_is_narrow_string (str)) | |
105 | { | |
106 | ret = mem_iconveh (scm_i_string_chars (str), ilen, | |
107 | - "ISO-8859-1", enc, | |
108 | + "UTF-8", enc, | |
109 | (enum iconv_ilseq_handler) handler, NULL, | |
110 | &buf, &len); | |
111 |