diff options
Diffstat (limited to 'svtools/source/svhtml/parhtml.cxx')
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index b4eb6c05cffd..67fc5f619fdf 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: parhtml.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -2341,3 +2338,38 @@ rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime ) return RTL_TEXTENCODING_DONTKNOW; } +rtl_TextEncoding HTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader ) +{ + rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW; + if( pHTTPHeader ) + { + SvKeyValue aKV; + for( BOOL bCont = pHTTPHeader->GetFirst( aKV ); bCont; + bCont = pHTTPHeader->GetNext( aKV ) ) + { + if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) + { + if( aKV.GetValue().Len() ) + { + eRet = HTMLParser::GetEncodingByMIME( aKV.GetValue() ); + } + } + } + } + return eRet; +} + +BOOL HTMLParser::SetEncodingByHTTPHeader( + SvKeyValueIterator *pHTTPHeader ) +{ + BOOL bRet = FALSE; + rtl_TextEncoding eEnc = HTMLParser::GetEncodingByHttpHeader( pHTTPHeader ); + if(RTL_TEXTENCODING_DONTKNOW != eEnc) + { + SetSrcEncoding( eEnc ); + bRet = TRUE; + } + return bRet; +} + + |