OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All
rights reserved. | 3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All
rights reserved. |
4 Copyright (C) 2005, 2006, 2007 Alexey Proskuryakov (ap@nypop.com) | 4 Copyright (C) 2005, 2006, 2007 Alexey Proskuryakov (ap@nypop.com) |
5 | 5 |
6 This library is free software; you can redistribute it and/or | 6 This library is free software; you can redistribute it and/or |
7 modify it under the terms of the GNU Library General Public | 7 modify it under the terms of the GNU Library General Public |
8 License as published by the Free Software Foundation; either | 8 License as published by the Free Software Foundation; either |
9 version 2 of the License, or (at your option) any later version. | 9 version 2 of the License, or (at your option) any later version. |
10 | 10 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } else if (bytesEqual(ptr, 0, 0, 0, '<', 0, 0, 0, '?')) { | 323 } else if (bytesEqual(ptr, 0, 0, 0, '<', 0, 0, 0, '?')) { |
324 setEncoding(UTF32BigEndianEncoding(), AutoDetectedEncoding); | 324 setEncoding(UTF32BigEndianEncoding(), AutoDetectedEncoding); |
325 } | 325 } |
326 | 326 |
327 m_checkedForXMLCharset = true; | 327 m_checkedForXMLCharset = true; |
328 return true; | 328 return true; |
329 } | 329 } |
330 | 330 |
331 void TextResourceDecoder::checkForMetaCharset(const char* data, size_t length) | 331 void TextResourceDecoder::checkForMetaCharset(const char* data, size_t length) |
332 { | 332 { |
333 if (m_source == UserChosenEncoding || m_source == EncodingFromHTTPHeader ||
m_source == AutoDetectedEncoding) { | 333 if (m_source == EncodingFromHTTPHeader || m_source == AutoDetectedEncoding)
{ |
334 m_checkedForMetaCharset = true; | 334 m_checkedForMetaCharset = true; |
335 return; | 335 return; |
336 } | 336 } |
337 | 337 |
338 if (!m_charsetParser) | 338 if (!m_charsetParser) |
339 m_charsetParser = HTMLMetaCharsetParser::create(); | 339 m_charsetParser = HTMLMetaCharsetParser::create(); |
340 | 340 |
341 if (!m_charsetParser->checkForMetaCharset(data, length)) | 341 if (!m_charsetParser->checkForMetaCharset(data, length)) |
342 return; | 342 return; |
343 | 343 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 m_codec = newTextCodec(m_encoding); | 433 m_codec = newTextCodec(m_encoding); |
434 | 434 |
435 String result = m_codec->decode(m_buffer.data(), m_buffer.size(), FetchEOF,
m_contentType == XMLContent && !m_useLenientXMLDecoding, m_sawError); | 435 String result = m_codec->decode(m_buffer.data(), m_buffer.size(), FetchEOF,
m_contentType == XMLContent && !m_useLenientXMLDecoding, m_sawError); |
436 m_buffer.clear(); | 436 m_buffer.clear(); |
437 m_codec.clear(); | 437 m_codec.clear(); |
438 m_checkedForBOM = false; // Skip BOM again when re-decoding. | 438 m_checkedForBOM = false; // Skip BOM again when re-decoding. |
439 return result; | 439 return result; |
440 } | 440 } |
441 | 441 |
442 } | 442 } |
OLD | NEW |