fix bug where scm_from_utf8_stringn would not detect bad utf-8
authorAndy Wingo <wingo@pobox.com>
Tue, 15 Jan 2013 10:01:10 +0000 (11:01 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 15 Jan 2013 10:01:10 +0000 (11:01 +0100)
commit8c76a8971ba92ebdf657199b74506f607987b523
treef21c9b4418a2f0a990906897a372324576d5bc33
parentb4fa6cc90961c87b28e26b469863f19a1be26ce2
fix bug where scm_from_utf8_stringn would not detect bad utf-8

* libguile/strings.c (scm_from_utf8_stringn):
* libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8"
  return from u8_mbtouc is a 0xfffd character, not a negative byte
  length.  Fixes a bug in which invalid UTF-8 would not be caught.

* libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn
  directly.  Just a little cleanup.

* test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for
  parsing bad utf-8 with substitution.
libguile/bytevectors.c
libguile/strings.c
libguile/symbols.c
test-suite/tests/iconv.test