pivot table procedure conceptually works
[pspp] / src / libpspp / encoding-guesser.h
index 2ec2fee2aaa19e0849cb64af078d8b730dad9f7c..1cb1a3ca4093a3ad111dc3bd77daf54711e2a1d7 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -42,7 +42,9 @@
        encoding"): Requests detection whether the input is encoded in UTF-8,
        UTF-16, UTF-32, or a few other easily identifiable charsets.  When a
        particular character set cannot be recognized, the guesser falls back to
-       the encoding following the comma.  UTF-8 detection works only for
+       the encoding following the comma.  When the fallback encoding is UTF-8,
+       but the input is invalid UTF-8, then the windows-1252 encoding (closely
+       related to ISO 8859-1) is used instead.  UTF-8 detection works only for
        ASCII-compatible character sets.
 
      - NULL or "Auto": As above, with the encoding used by the system locale as
@@ -107,14 +109,20 @@ bool encoding_guess_encoding_is_auto (const char *encoding);
 /* Making an initial coding guess based on the start of a file. */
 const char *encoding_guess_head_encoding (const char *encoding,
                                           const void *, size_t);
+size_t encoding_guess_bom_length (const char *encoding,
+                                  const void *, size_t n);
 
 /* Refining an initial ASCII coding guess using later non-ASCII bytes. */
 static inline bool encoding_guess_is_ascii_text (uint8_t c);
 size_t encoding_guess_count_ascii (const void *, size_t);
-bool encoding_guess_tail_is_utf8 (const void *, size_t);
+int encoding_guess_tail_is_utf8 (const void *, size_t);
 const char *encoding_guess_tail_encoding (const char *encoding,
                                           const void *, size_t);
 
+/* Guessing from entire file contents. */
+const char *encoding_guess_whole_file (const char *encoding,
+                                       const void *, size_t);
+
 /* Returns true if C is a byte that might appear in an ASCII text file,
    false otherwise. */
 static inline bool