<!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>[172175] branches/safari-600.1.4-branch/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/172175">172175</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-08-06 14:09:47 -0700 (Wed, 06 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/172172">r172172</a>. &lt;rdar://problem/17862892&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari60014branchSourceWebCoreChangeLog">branches/safari-600.1.4-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreWebCoreexpin">branches/safari-600.1.4-branch/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm">branches/safari-600.1.4-branch/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreplatformmacWebCoreSystemInterfaceh">branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreplatformmacWebCoreSystemInterfacemm">branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreplatformtextTextEncodingRegistrycpp">branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.cpp</a></li>
<li><a href="#branchessafari60014branchSourceWebCoreplatformtextTextEncodingRegistryh">branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.h</a></li>
<li><a href="#branchessafari60014branchSourceWebKitmacChangeLog">branches/safari-600.1.4-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari60014branchSourceWebKitmacWebCoreSupportWebSystemInterfacemm">branches/safari-600.1.4-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm</a></li>
<li><a href="#branchessafari60014branchSourceWebKitmacWebViewWebPreferencesmm">branches/safari-600.1.4-branch/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#branchessafari60014branchSourceWebKit2ChangeLog">branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari60014branchSourceWebKit2SharedWebPreferencesDefinitionsh">branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h</a></li>
<li><a href="#branchessafari60014branchSourceWebKit2SharedWebPreferencesStorecpp">branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesStore.cpp</a></li>
<li><a href="#branchessafari60014branchSourceWebKit2UIProcessWebPreferencescpp">branches/safari-600.1.4-branch/Source/WebKit2/UIProcess/WebPreferences.cpp</a></li>
<li><a href="#branchessafari60014branchSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm">branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari60014branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/ChangeLog (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/ChangeLog        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/ChangeLog        2014-08-06 21:09:47 UTC (rev 172175)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r172172. &lt;rdar://problem/17862892&gt;
+
+    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:
+    
+2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r172159. &lt;rdar://problem/17869353&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-08-06  Andy Estes  &lt;aestes@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari60014branchSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/WebCore.exp.in (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/WebCore.exp.in        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/WebCore.exp.in        2014-08-06 21:09:47 UTC (rev 172175)
</span><span class="lines">@@ -1071,6 +1071,7 @@
</span><span class="cx"> __ZN7WebCore3URLC1ERKS0_RKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore3macERKNS_10CredentialE
</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">@@ -2103,6 +2104,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="branchessafari60014branchSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebCoreplatformmacWebCoreSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebCoreplatformmacWebCoreSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebCoreplatformtextTextEncodingRegistrycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.cpp (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.cpp        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.cpp        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebCoreplatformtextTextEncodingRegistryh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.h (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.h        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebCore/platform/text/TextEncodingRegistry.h        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit/mac/ChangeLog (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit/mac/ChangeLog        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit/mac/ChangeLog        2014-08-06 21:09:47 UTC (rev 172175)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r172172. &lt;rdar://problem/17862892&gt;
+
+    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  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r172016. &lt;rdar://problem/17896295&gt;
</span></span></pre></div>
<a id="branchessafari60014branchSourceWebKitmacWebCoreSupportWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit/mac/WebView/WebPreferences.mm (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit/mac/WebView/WebPreferences.mm        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit/mac/WebView/WebPreferences.mm        2014-08-06 21:09:47 UTC (rev 172175)
</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">@@ -1740,16 +1741,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="branchessafari60014branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit2/ChangeLog        2014-08-06 21:09:47 UTC (rev 172175)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r172172. &lt;rdar://problem/17862892&gt;
+
+    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.
+    
+2014-08-06  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
</ins><span class="cx">         Merge r172035. &lt;rdar://problem/17869353&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-08-04  Andy Estes  &lt;aestes@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari60014branchSourceWebKit2SharedWebPreferencesDefinitionsh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesDefinitions.h        2014-08-06 21:09:47 UTC (rev 172175)
</span><span class="lines">@@ -281,7 +281,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="branchessafari60014branchSourceWebKit2SharedWebPreferencesStorecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesStore.cpp (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesStore.cpp        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit2/Shared/WebPreferencesStore.cpp        2014-08-06 21:09:47 UTC (rev 172175)
</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="branchessafari60014branchSourceWebKit2UIProcessWebPreferencescpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit2/UIProcess/WebPreferences.cpp (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit2/UIProcess/WebPreferences.cpp        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit2/UIProcess/WebPreferences.cpp        2014-08-06 21:09:47 UTC (rev 172175)
</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;m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::javaEnabledKey(), true);
</span><span class="cx">     preferences-&gt;m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::javaEnabledForLocalFilesKey(), true);
</span><span class="cx">     preferences-&gt;m_store.setOverrideDefaultsBoolValueForKey(WebPreferencesKey::pluginsEnabledKey(), true);
</span></span></pre></div>
<a id="branchessafari60014branchSourceWebKit2WebProcessWebCoreSupportmacWebSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (172174 => 172175)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-08-06 20:38:15 UTC (rev 172174)
+++ branches/safari-600.1.4-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm        2014-08-06 21:09:47 UTC (rev 172175)
</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>