OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> | 3 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 do { | 329 do { |
330 decodeToBuffer(buffer, bufferLimit, source, sourceLimit, offsets, tr
ue, err); | 330 decodeToBuffer(buffer, bufferLimit, source, sourceLimit, offsets, tr
ue, err); |
331 } while (source < sourceLimit); | 331 } while (source < sourceLimit); |
332 sawError = true; | 332 sawError = true; |
333 } | 333 } |
334 | 334 |
335 String resultString = String::adopt(result); | 335 String resultString = String::adopt(result); |
336 | 336 |
337 // <http://bugs.webkit.org/show_bug.cgi?id=17014> | 337 // <http://bugs.webkit.org/show_bug.cgi?id=17014> |
338 // Simplified Chinese pages use the code A3A0 to mean "full-width space", bu
t ICU decodes it as U+E5E5. | 338 // Simplified Chinese pages use the code A3A0 to mean "full-width space", bu
t ICU decodes it as U+E5E5. |
339 if (m_encoding == "GBK" || m_encoding == "gb18030") | 339 if (strcmp(m_encoding.name(), "GBK") == 0 || strcmp(m_encoding.name(), "gb18
030") == 0) |
340 resultString.replace(0xE5E5, ideographicSpace); | 340 resultString.replace(0xE5E5, ideographicSpace); |
341 | 341 |
342 return resultString; | 342 return resultString; |
343 } | 343 } |
344 | 344 |
345 // We need to apply these fallbacks ourselves as they are not currently supporte
d by ICU and | 345 // We need to apply these fallbacks ourselves as they are not currently supporte
d by ICU and |
346 // they were provided by the old TEC encoding path | 346 // they were provided by the old TEC encoding path |
347 // Needed to fix <rdar://problem/4708689> | 347 // Needed to fix <rdar://problem/4708689> |
348 static UChar getGbkEscape(UChar32 codePoint) | 348 static UChar getGbkEscape(UChar32 codePoint) |
349 { | 349 { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 result.grow(size + count); | 470 result.grow(size + count); |
471 memcpy(result.data() + size, buffer, count); | 471 memcpy(result.data() + size, buffer, count); |
472 size += count; | 472 size += count; |
473 } while (err == U_BUFFER_OVERFLOW_ERROR); | 473 } while (err == U_BUFFER_OVERFLOW_ERROR); |
474 | 474 |
475 return CString(result.data(), size); | 475 return CString(result.data(), size); |
476 } | 476 } |
477 | 477 |
478 | 478 |
479 } // namespace WebCore | 479 } // namespace WebCore |
OLD | NEW |