[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fencepost error in encoding processing
From: |
Ken Raeburn |
Subject: |
fencepost error in encoding processing |
Date: |
Sat, 14 Nov 2009 23:36:13 -0500 |
The Mac build started failing for me again, complaining about an
unknown encoding "UTF-8;" -- yes, with a semicolon on the end. So it
may not be surprising to find that it's a minor fencepost error in
processing the emacs-style encoding spec in boot-9.scm.
Why did this not show up before for you GNU/Linux guys? :-) Well, it
turns out, the GNU libc version of iconv_open is being "helpful":
iconv_t
iconv_open (const char *tocode, const char *fromcode)
{
/* Normalize the name. We remove all characters beside alpha-
numeric,
'_', '-', '/', '.', and ':'. */
...
If there's reason to believe that all these characters might show up
in valid encoding names, we might want to borrow that list for
scm_i_scan_for_encoding too. In fact, since we don't control the
iconv implementation, we should probably be *at least* as lenient as
glibc in accepting random characters.
Okay to check in?
Ken
Fix fencepost error in processing Emacs-style coding declaration.
diff --git a/libguile/read.c b/libguile/read.c
index e403cc3..775612a 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1513,7 +1513,7 @@ scm_i_scan_for_encoding (SCM port)
if (i == 0)
return NULL;
- encoding = scm_gc_strndup (pos, i + 1, "encoding");
+ encoding = scm_gc_strndup (pos, i, "encoding");
for (i = 0; i < strlen (encoding); i++)
encoding[i] = toupper ((int) encoding[i]);