| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> |
| 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 ASSERT(U_SUCCESS(err)); | 114 ASSERT(U_SUCCESS(err)); |
| 115 | 115 |
| 116 source = normalizedCharacters.data(); | 116 source = normalizedCharacters.data(); |
| 117 length = normalizedLength; | 117 length = normalizedLength; |
| 118 } | 118 } |
| 119 | 119 |
| 120 return newTextCodec(*this)->encode(source, length, handling); | 120 return newTextCodec(*this)->encode(source, length, handling); |
| 121 } | 121 } |
| 122 | 122 |
| 123 const char* TextEncoding::domName() const |
| 124 { |
| 125 if (noExtendedTextEncodingNameUsed()) |
| 126 return m_name; |
| 127 |
| 128 // We treat EUC-KR as windows-949 (its superset), but need to expose |
| 129 // the name 'EUC-KR' because the name 'windows-949' is not recognized by |
| 130 // most Korean web servers even though they do use the encoding |
| 131 // 'windows-949' with the name 'EUC-KR'. |
| 132 // FIXME: This is not thread-safe. At the moment, this function is |
| 133 // only accessed in a single thread, but eventually has to be made |
| 134 // thread-safe along with usesVisualOrdering(). |
| 135 static const char* const a = atomicCanonicalTextEncodingName("windows-949"); |
| 136 if (m_name == a) |
| 137 return "EUC-KR"; |
| 138 return m_name; |
| 139 } |
| 140 |
| 123 bool TextEncoding::usesVisualOrdering() const | 141 bool TextEncoding::usesVisualOrdering() const |
| 124 { | 142 { |
| 125 if (noExtendedTextEncodingNameUsed()) | 143 if (noExtendedTextEncodingNameUsed()) |
| 126 return false; | 144 return false; |
| 127 | 145 |
| 128 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8"); | 146 static const char* const a = atomicCanonicalTextEncodingName("ISO-8859-8"); |
| 129 return m_name == a; | 147 return m_name == a; |
| 130 } | 148 } |
| 131 | 149 |
| 132 bool TextEncoding::isJapanese() const | 150 bool TextEncoding::isJapanese() const |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return globalUTF8Encoding; | 240 return globalUTF8Encoding; |
| 223 } | 241 } |
| 224 | 242 |
| 225 const TextEncoding& WindowsLatin1Encoding() | 243 const TextEncoding& WindowsLatin1Encoding() |
| 226 { | 244 { |
| 227 static TextEncoding globalWindowsLatin1Encoding("WinLatin1"); | 245 static TextEncoding globalWindowsLatin1Encoding("WinLatin1"); |
| 228 return globalWindowsLatin1Encoding; | 246 return globalWindowsLatin1Encoding; |
| 229 } | 247 } |
| 230 | 248 |
| 231 } // namespace WTF | 249 } // namespace WTF |
| OLD | NEW |