From 888d895ec5bfcc439c8174184c388f3be3f117a0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 26 Apr 2011 21:36:24 -0700 Subject: [PATCH] encoding-guesser: Don't guess UTF-8 for ASCII if it is the fallback. When the text presented to the encoding guesser is all ASCII, normally the encoding guesser will report ASCII as its guess. But if the fallback encoding is UTF-8, then it reports UTF-8 instead. Unfortunately, this makes the encoding guesser a bit harder to test, because guesses depend on the system's locale. It's easier to test if all-ASCII always yields ASCII as the guess, so this changes the encoding guesser to do that. This fixes a test failure on Mac OS X. Thanks to Jeremy Lavergne for reporting the problem. --- src/libpspp/encoding-guesser.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libpspp/encoding-guesser.c b/src/libpspp/encoding-guesser.c index 9042e93a..298861e0 100644 --- a/src/libpspp/encoding-guesser.c +++ b/src/libpspp/encoding-guesser.c @@ -250,10 +250,6 @@ encoding_guess_head_encoding (const char *encoding, || !encoding_guess_tail_is_utf8 (data, n)) return fallback_encoding; - if (!c_strcasecmp (fallback_encoding, "UTF-8") - || !c_strcasecmp (fallback_encoding, "UTF8")) - return "UTF-8"; - return "ASCII"; } -- 2.30.2