summaryrefslogtreecommitdiff
path: root/src/htscharset.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-05-13 11:17:31 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-05-13 11:17:31 +0000
commit8cdb6d6fb056575f58eaf7e1a8fae2f31c321d13 (patch)
tree03cf143582b475f3a973ee5569501e7d313a5645 /src/htscharset.c
parent1c496d66c8d39fac3ec5dee010e5ef7f3cba83ba (diff)
Limit the final destination path lenght to 256 (Windows compatibility)
See http://code.google.com/p/httrack/issues/detail?id=9
Diffstat (limited to 'src/htscharset.c')
-rw-r--r--src/htscharset.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/htscharset.c b/src/htscharset.c
index f19e47c..351fa8c 100644
--- a/src/htscharset.c
+++ b/src/htscharset.c
@@ -502,6 +502,18 @@ static int is_space_or_equal_or_quote(char c) {
return is_space_or_equal(c) || c == '"' || c == '\'';
}
+size_t hts_stringLengthUTF8(const char *s) {
+ const unsigned char *const bytes = (const unsigned char*) s;
+ size_t i, len;
+ for(i = 0, len = 0 ; bytes[i] != '\0' ; i++) {
+ const unsigned char c = bytes[i];
+ if (HTS_IS_LEADING_UTF8(c)) { // ASCII or leading byte
+ len++;
+ }
+ }
+ return len;
+}
+
char* hts_getCharsetFromMeta(const char *html, size_t size) {
int i;
// <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8" >