OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007, 2008, 2011 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 case QuestionMarksForUnencodables: | 610 case QuestionMarksForUnencodables: |
611 // Non-byte-based encodings (i.e. UTF-16/32) don't need substitutions | 611 // Non-byte-based encodings (i.e. UTF-16/32) don't need substitutions |
612 // since they can encode any code point, and ucnv_setSubstChars would | 612 // since they can encode any code point, and ucnv_setSubstChars would |
613 // require a multi-byte substitution anyway. | 613 // require a multi-byte substitution anyway. |
614 if (!m_encoding.isNonByteBasedEncoding()) | 614 if (!m_encoding.isNonByteBasedEncoding()) |
615 ucnv_setSubstChars(m_converterICU, "?", 1, &err); | 615 ucnv_setSubstChars(m_converterICU, "?", 1, &err); |
616 #if !defined(USING_SYSTEM_ICU) | 616 #if !defined(USING_SYSTEM_ICU) |
617 ucnv_setFromUCallBack(m_converterICU, UCNV_FROM_U_CALLBACK_SUBSTITUTE, 0, | 617 ucnv_setFromUCallBack(m_converterICU, UCNV_FROM_U_CALLBACK_SUBSTITUTE, 0, |
618 0, 0, &err); | 618 0, 0, &err); |
619 #else | 619 #else |
620 ucnv_setFromUCallBack( | 620 ucnv_setFromUCallBack(m_converterICU, |
621 m_converterICU, m_needsGBKFallbacks ? gbkCallbackSubstitute | 621 m_needsGBKFallbacks |
622 : UCNV_FROM_U_CALLBACK_SUBSTITUTE, | 622 ? gbkCallbackSubstitute |
623 0, 0, 0, &err); | 623 : UCNV_FROM_U_CALLBACK_SUBSTITUTE, |
| 624 0, 0, 0, &err); |
624 #endif | 625 #endif |
625 break; | 626 break; |
626 case EntitiesForUnencodables: | 627 case EntitiesForUnencodables: |
627 #if !defined(USING_SYSTEM_ICU) | 628 #if !defined(USING_SYSTEM_ICU) |
628 ucnv_setFromUCallBack(m_converterICU, numericEntityCallback, 0, 0, 0, | 629 ucnv_setFromUCallBack(m_converterICU, numericEntityCallback, 0, 0, 0, |
629 &err); | 630 &err); |
630 #else | 631 #else |
631 ucnv_setFromUCallBack( | 632 ucnv_setFromUCallBack( |
632 m_converterICU, | 633 m_converterICU, |
633 m_needsGBKFallbacks ? gbkCallbackEscape : numericEntityCallback, 0, 0, | 634 m_needsGBKFallbacks ? gbkCallbackEscape : numericEntityCallback, 0, 0, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 return encodeCommon(characters, length, handling); | 703 return encodeCommon(characters, length, handling); |
703 } | 704 } |
704 | 705 |
705 CString TextCodecICU::encode(const LChar* characters, | 706 CString TextCodecICU::encode(const LChar* characters, |
706 size_t length, | 707 size_t length, |
707 UnencodableHandling handling) { | 708 UnencodableHandling handling) { |
708 return encodeCommon(characters, length, handling); | 709 return encodeCommon(characters, length, handling); |
709 } | 710 } |
710 | 711 |
711 } // namespace WTF | 712 } // namespace WTF |
OLD | NEW |