| 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 0ac5ea6a6..f73301e2f 100644
|
| 8 | |
| 9 | |
| 10 | @@ -1931,7 +1931,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 45e62f4e4..42012f3aa 100644
|
| 21 | |
| 22 | |
| 23 | @@ -974,7 +974,9 @@ canonicalize_encoding (const char *enc)
|
| 24 | char *ret;
|
| 25 | int i;
|
| 26 |
|
| 27 | - if (!enc || encoding_matches (enc, sym_ISO_8859_1))
|
| 28 | + if (enc == NULL)
|
| 29 | + return sym_UTF_8;
|
| 30 | + if (encoding_matches (enc, sym_ISO_8859_1))
|
| 31 | return sym_ISO_8859_1;
|
| 32 | if (encoding_matches (enc, sym_UTF_8))
|
| 33 | return sym_UTF_8;
|
| 34 | @@ -4198,7 +4200,7 @@ scm_init_ports (void)
|
| 35 | scm_c_define ("%default-port-conversion-strategy",
|
| 36 | scm_make_fluid_with_default (sym_substitute));
|
| 37 | /* Use the locale as the default port encoding. */
|
| 38 | - scm_i_set_default_port_encoding (locale_charset ());
|
| 39 | + scm_i_set_default_port_encoding ("UTF-8");
|
| 40 |
|
| 41 | scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
|
| 42 | "scm_init_ice_9_ports",
|
| 43 | diff --git a/libguile/strings.c b/libguile/strings.c
|
| 44 | index 056b4c99f..63a6c050d 100644
|
| 45 | |
| 46 | |
| 47 | @@ -1579,7 +1579,7 @@ scm_i_default_string_failed_conversion_handler (void)
|
| 48 | SCM
|
| 49 | scm_from_locale_stringn (const char *str, size_t len)
|
| 50 | {
|
| 51 | - return scm_from_stringn (str, len, locale_charset (),
|
| 52 | + return scm_from_stringn (str, len, "UTF-8",
|
| 53 | scm_i_default_string_failed_conversion_handler ());
|
| 54 | }
|
| 55 |
|
| 56 | @@ -1907,7 +1907,7 @@ char *
|
| 57 | scm_to_locale_stringn (SCM str, size_t *lenp)
|
| 58 | {
|
| 59 | return scm_to_stringn (str, lenp,
|
| 60 | - locale_charset (),
|
| 61 | + "UTF-8",
|
| 62 | scm_i_default_string_failed_conversion_handler ());
|
| 63 | }
|
| 64 |
|
| 65 | @@ -2195,7 +2195,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
|
| 66 | scm_wrong_type_arg_msg (NULL, 0, str, "string");
|
| 67 |
|
| 68 | if (encoding == NULL)
|
| 69 | - encoding = "ISO-8859-1";
|
| 70 | + encoding = "UTF-8";
|
| 71 |
|
| 72 | if (c_strcasecmp (encoding, "UTF-8") == 0)
|
| 73 | /* This is the most common case--e.g., when calling libc bindings
|
| 74 | @@ -2247,7 +2247,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
|
| 75 | if (scm_i_is_narrow_string (str))
|
| 76 | {
|
| 77 | ret = mem_iconveh (scm_i_string_chars (str), ilen,
|
| 78 | - "ISO-8859-1", encoding,
|
| 79 | + "UTF-8", encoding,
|
| 80 | (enum iconv_ilseq_handler) handler, NULL,
|
| 81 | &buf, &len);
|
| 82 |
|