<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[172172] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/172172">172172</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-08-06 13:25:00 -0700 (Wed, 06 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (WebKit2): iOS Safari default encoding doesn't follow system language
https://bugs.webkit.org/show_bug.cgi?id=135667
&lt;rdar://problem/17862892&gt;

Reviewed by Anders Carlsson.


Source/WebCore: 
Moved a function that computes default encoding from WebKit to WebCore, so that
it could be shared with WebKit2.

* WebCore.exp.in:
* platform/ios/WebCoreSystemInterfaceIOS.mm:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:
* platform/text/TextEncodingRegistry.cpp:
(WebCore::defaultTextEncodingNameForSystemLanguage):
* platform/text/TextEncodingRegistry.h:

Source/WebKit/mac: 
* WebView/WebPreferences.mm: (+[WebPreferences _setInitialDefaultTextEncodingToSystemEncoding]):
Moved implementation to WebCore, so that it can be shared with WebKit2.

* WebCoreSupport/WebSystemInterface.mm: (InitWebCoreSystemInterface):
We now use WKGetWebDefaultCFStringEncoding in WebCore, so it needs to be initialized.

Source/WebKit2: 
* Shared/WebPreferencesDefinitions.h: Compute the actual proper default, don't
hardcode it to ISO-8859-1 hoping that someone else will correct it later.

* Shared/WebPreferencesStore.cpp: Added an include for WebPreferencesDefinitions.h
macro expansion to compile.

* UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::createWithLegacyDefaults):
Added a FIXME.

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface):
We now use WKGetWebDefaultCFStringEncoding in WebCore, so it needs to be initialized.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm">trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextEncodingRegistrycpp">trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformtextTextEncodingRegistryh">trunk/Source/WebCore/platform/text/TextEncodingRegistry.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm">trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPreferencesDefinitionsh">trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPreferencesStorecpp">trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPreferencescpp">trunk/Source/WebKit2/UIProcess/WebPreferences.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/ChangeLog        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-08-06  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (WebKit2): iOS Safari default encoding doesn't follow system language
+        https://bugs.webkit.org/show_bug.cgi?id=135667
+        &lt;rdar://problem/17862892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Moved a function that computes default encoding from WebKit to WebCore, so that
+        it could be shared with WebKit2.
+
+        * WebCore.exp.in:
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        * platform/text/TextEncodingRegistry.cpp:
+        (WebCore::defaultTextEncodingNameForSystemLanguage):
+        * platform/text/TextEncodingRegistry.h:
+
</ins><span class="cx"> 2014-08-06  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove unused RenderBox::reflectionBox().
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -1075,6 +1075,7 @@
</span><span class="cx"> __ZN7WebCore3URLC1EPK7__CFURL
</span><span class="cx"> __ZN7WebCore3URLC1ERKS0_RKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore3macERKNS_23AuthenticationChallengeE
</span><ins>+__ZN7WebCore40defaultTextEncodingNameForSystemLanguageEv
</ins><span class="cx"> __ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf
</span><span class="cx"> __ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURL18CFURLComponentType
</span><span class="cx"> __ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
</span><span class="lines">@@ -2104,6 +2105,7 @@
</span><span class="cx"> _wkGetMIMETypeForExtension
</span><span class="cx"> _wkGetNSURLResponseLastModifiedDate
</span><span class="cx"> _wkGetUserToBaseCTM
</span><ins>+_wkGetWebDefaultCFStringEncoding
</ins><span class="cx"> _wkHTTPCookies
</span><span class="cx"> _wkHTTPCookiesForURL
</span><span class="cx"> _wkHTTPRequestEnablePipelining
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx"> void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight); 
</span><span class="cx"> void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
</span><span class="cx"> CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
</span><ins>+CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
</ins><span class="cx"> 
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> CFHTTPCookieStorageRef (*wkGetDefaultHTTPCookieStorage)();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -152,6 +152,7 @@
</span><span class="cx"> extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
</span><span class="cx"> extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
</span><span class="cx"> extern CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
</span><ins>+extern CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> extern void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
</span><span class="cx"> extern void (*wkDrawTextFieldCellFocusRing)(NSTextFieldCell*, NSRect);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);
</span><span class="cx"> NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
</span><span class="cx"> CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*);
</span><ins>+CFStringEncoding (*wkGetWebDefaultCFStringEncoding)(void);
</ins><span class="cx"> NSString* (*wkCreateURLPasteboardFlavorTypeName)(void);
</span><span class="cx"> NSString* (*wkCreateURLNPasteboardFlavorTypeName)(void);
</span><span class="cx"> void (*wkDrawBezeledTextFieldCell)(NSRect, BOOL enabled);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextEncodingRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -42,6 +42,10 @@
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/StringExtras.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+#include &quot;WebCoreSystemInterface.h&quot;
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include &quot;TextCodecMac.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -350,6 +354,21 @@
</span><span class="cx">     return !didExtendTextCodecMaps;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+String defaultTextEncodingNameForSystemLanguage()
+{
+    String systemEncodingName = CFStringConvertEncodingToIANACharSetName(wkGetWebDefaultCFStringEncoding());
+
+    // CFStringConvertEncodingToIANACharSetName() returns cp949 for kTextEncodingDOSKorean AKA &quot;extended EUC-KR&quot; AKA windows-949.
+    // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-949.
+    // In addition, this value must match what is used in Safari, see &lt;rdar://problem/5579292&gt;.
+    // On some OS versions, the result is CP949 (uppercase).
+    if (equalIgnoringCase(systemEncodingName, &quot;cp949&quot;))
+        systemEncodingName = &quot;ks_c_5601-1987&quot;;
+    return systemEncodingName;
+}
+#endif
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void dumpTextEncodingNameMap()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextTextEncodingRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.h (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.h        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.h        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -48,6 +48,10 @@
</span><span class="cx">     bool isJapaneseEncoding(const char* canonicalEncodingName);
</span><span class="cx">     bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+    String defaultTextEncodingNameForSystemLanguage();
+#endif
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     void dumpTextEncodingNameMap();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-08-06  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (WebKit2): iOS Safari default encoding doesn't follow system language
+        https://bugs.webkit.org/show_bug.cgi?id=135667
+        &lt;rdar://problem/17862892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * WebView/WebPreferences.mm: (+[WebPreferences _setInitialDefaultTextEncodingToSystemEncoding]):
+        Moved implementation to WebCore, so that it can be shared with WebKit2.
+
+        * WebCoreSupport/WebSystemInterface.mm: (InitWebCoreSystemInterface):
+        We now use WKGetWebDefaultCFStringEncoding in WebCore, so it needs to be initialized.
+
</ins><span class="cx"> 2014-08-05  Peyton Randolph  &lt;prandolph@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename MAC_LONG_PRESS feature flag to LONG_MOUSE_PRESS.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -80,6 +80,7 @@
</span><span class="cx">     INIT(GetHTTPRequestPriority);
</span><span class="cx">     INIT(GetMIMETypeForExtension);
</span><span class="cx">     INIT(GetNSURLResponseLastModifiedDate);
</span><ins>+    INIT(GetWebDefaultCFStringEncoding);
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     INIT(SignedPublicKeyAndChallengeString);
</span><span class="cx">     INIT(GetPreferredExtensionForMIMEType);
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #import &lt;WebCore/AudioSession.h&gt;
</span><span class="cx"> #import &lt;WebCore/NetworkStorageSession.h&gt;
</span><span class="cx"> #import &lt;WebCore/ResourceHandle.h&gt;
</span><ins>+#import &lt;WebCore/TextEncodingRegistry.h&gt;
</ins><span class="cx"> #import &lt;runtime/InitializeThreading.h&gt;
</span><span class="cx"> #import &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -1715,16 +1716,8 @@
</span><span class="cx"> 
</span><span class="cx"> + (void)_setInitialDefaultTextEncodingToSystemEncoding
</span><span class="cx"> {
</span><del>-    NSString *systemEncodingName = (NSString *)CFStringConvertEncodingToIANACharSetName([self _systemCFStringEncoding]);
-
-    // CFStringConvertEncodingToIANACharSetName() returns cp949 for kTextEncodingDOSKorean AKA &quot;extended EUC-KR&quot; AKA windows-949.
-    // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-949.
-    // In addition, this value must match what is used in Safari, see &lt;rdar://problem/5579292&gt;.
-    // On some OS versions, the result is CP949 (uppercase).
-    if ([systemEncodingName _webkit_isCaseInsensitiveEqualToString:@&quot;cp949&quot;])
-        systemEncodingName = @&quot;ks_c_5601-1987&quot;;
</del><span class="cx">     [[NSUserDefaults standardUserDefaults] registerDefaults:
</span><del>-        [NSDictionary dictionaryWithObject:systemEncodingName forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
</del><ins>+        [NSDictionary dictionaryWithObject:defaultTextEncodingNameForSystemLanguage() forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static NSString *classIBCreatorID = nil;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit2/ChangeLog        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-08-06  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (WebKit2): iOS Safari default encoding doesn't follow system language
+        https://bugs.webkit.org/show_bug.cgi?id=135667
+        &lt;rdar://problem/17862892&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/WebPreferencesDefinitions.h: Compute the actual proper default, don't
+        hardcode it to ISO-8859-1 hoping that someone else will correct it later.
+
+        * Shared/WebPreferencesStore.cpp: Added an include for WebPreferencesDefinitions.h
+        macro expansion to compile.
+
+        * UIProcess/WebPreferences.cpp: (WebKit::WebPreferences::createWithLegacyDefaults):
+        Added a FIXME.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: (InitWebCoreSystemInterface):
+        We now use WKGetWebDefaultCFStringEncoding in WebCore, so it needs to be initialized.
+
</ins><span class="cx"> 2014-08-06  Adrian Perez de Castro  &lt;aperez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Add support for user scripts to WebKitUserContentManager
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPreferencesDefinitionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -275,7 +275,7 @@
</span><span class="cx"> 
</span><span class="cx"> #define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \
</span><span class="cx">     FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
</span><del>-    macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, &quot;ISO-8859-1&quot;) \
</del><ins>+    macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, defaultTextEncodingNameForSystemLanguage()) \
</ins><span class="cx">     macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, &quot;&quot;) \
</span><span class="cx">     \
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPreferencesStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -30,12 +30,15 @@
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebPreferencesKeys.h&quot;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><ins>+#include &lt;WebCore/TextEncodingRegistry.h&gt;
</ins><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &lt;WebKitSystemInterfaceIOS.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+using namespace WebCore;
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;String, bool&gt; BoolOverridesMap;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPreferencescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPreferences.cpp (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPreferences.cpp        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit2/UIProcess/WebPreferences.cpp        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx"> PassRefPtr&lt;WebPreferences&gt; WebPreferences::createWithLegacyDefaults(const String&amp; identifier, const String&amp; keyPrefix, const String&amp; globalDebugKeyPrefix)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;WebPreferences&gt; preferences = adoptRef(new WebPreferences(identifier, keyPrefix, globalDebugKeyPrefix));
</span><ins>+    // FIXME: The registerDefault...ValueForKey machinery is unnecessarily heavyweight and complicated.
+    // We can just compute different defaults for modern and legacy APIs in WebPreferencesDefinitions.h macros.
</ins><span class="cx">     preferences-&gt;registerDefaultBoolValueForKey(WebPreferencesKey::javaEnabledKey(), true);
</span><span class="cx">     preferences-&gt;registerDefaultBoolValueForKey(WebPreferencesKey::javaEnabledForLocalFilesKey(), true);
</span><span class="cx">     preferences-&gt;registerDefaultBoolValueForKey(WebPreferencesKey::pluginsEnabledKey(), true);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (172171 => 172172)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-08-06 20:23:43 UTC (rev 172171)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-08-06 20:25:00 UTC (rev 172172)
</span><span class="lines">@@ -80,6 +80,7 @@
</span><span class="cx">         INIT(GetPreferredExtensionForMIMEType);
</span><span class="cx"> #endif
</span><span class="cx">         INIT(GetUserToBaseCTM);
</span><ins>+        INIT(GetWebDefaultCFStringEncoding);
</ins><span class="cx">         INIT(CGContextIsPDFContext);
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">         INIT(GetWheelEventDeltas);
</span></span></pre>
</div>
</div>

</body>
</html>