Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133339482
D24919.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24919.id.diff
View Options
Index: head/contrib/nvi/common/exf.c
===================================================================
--- head/contrib/nvi/common/exf.c
+++ head/contrib/nvi/common/exf.c
@@ -1237,7 +1237,10 @@
}
/*
- * Detect UTF-8 and fallback to the locale/preset encoding.
+ * 1. Check for valid UTF-8.
+ * 2. Check if fallback fileencoding is set and is NOT UTF-8.
+ * 3. Check if user locale's encoding is NOT UTF-8.
+ * 4. Use ISO8859-1 as last resort.
*
* XXX
* A manually set O_FILEENCODING indicates the "fallback
@@ -1246,9 +1249,13 @@
*/
if (looks_utf8(buf, blen) > 1)
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
- else if (!O_ISSET(sp, O_FILEENCODING) ||
- !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
+ else if (O_ISSET(sp, O_FILEENCODING) &&
+ strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0)
+ /* Use fileencoding as is */ ;
+ else if (strcasecmp(codeset(), "utf-8") != 0)
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
+ else
+ o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0);
conv_enc(sp, O_FILEENCODING, 0);
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 1:13 AM (7 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24185096
Default Alt Text
D24919.id.diff (1 KB)
Attached To
Mode
D24919: nvi: fallback to iso8859-1 if utf-8 check failed and fileencoding/locale encoding is utf-8
Attached
Detach File
Event Timeline
Log In to Comment