Add config option for setting default charset.

This will be used for pages with no specified charset.
This commit is contained in:
Quentin Rameau 2017-05-11 15:23:22 +02:00
parent 745a319baf
commit 298e688933
2 changed files with 6 additions and 0 deletions

View File

@ -13,6 +13,7 @@ static Parameter defconfig[ParameterLast] = {
SETB(Certificate, 0), SETB(Certificate, 0),
SETB(CaretBrowsing, 0), SETB(CaretBrowsing, 0),
SETV(CookiePolicies, "@Aa"), SETV(CookiePolicies, "@Aa"),
SETV(DefaultCharset, "UTF-8"),
SETB(DiskCache, 1), SETB(DiskCache, 1),
SETB(DNSPrefetch, 0), SETB(DNSPrefetch, 0),
SETI(FontSize, 12), SETI(FontSize, 12),

5
surf.c
View File

@ -65,6 +65,7 @@ typedef enum {
Certificate, Certificate,
CookiePolicies, CookiePolicies,
DiskCache, DiskCache,
DefaultCharset,
DNSPrefetch, DNSPrefetch,
FontSize, FontSize,
FrameFlattening, FrameFlattening,
@ -695,6 +696,9 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
WEBKIT_CACHE_MODEL_WEB_BROWSER : WEBKIT_CACHE_MODEL_WEB_BROWSER :
WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER); WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
return; /* do not update */ return; /* do not update */
case DefaultCharset:
webkit_settings_set_default_charset(s, a->v);
return; /* do not update */
case DNSPrefetch: case DNSPrefetch:
webkit_settings_set_enable_dns_prefetching(s, a->b); webkit_settings_set_enable_dns_prefetching(s, a->b);
return; /* do not update */ return; /* do not update */
@ -1008,6 +1012,7 @@ newview(Client *c, WebKitWebView *rv)
} else { } else {
settings = webkit_settings_new_with_settings( settings = webkit_settings_new_with_settings(
"auto-load-images", curconfig[LoadImages].val.b, "auto-load-images", curconfig[LoadImages].val.b,
"default-charset", curconfig[DefaultCharset].val.v,
"default-font-size", curconfig[FontSize].val.i, "default-font-size", curconfig[FontSize].val.i,
"enable-caret-browsing", curconfig[CaretBrowsing].val.b, "enable-caret-browsing", curconfig[CaretBrowsing].val.b,
"enable-developer-extras", curconfig[Inspector].val.b, "enable-developer-extras", curconfig[Inspector].val.b,