From 09eb749318e40150ae37f470f2dfd2852d9c8301 Mon Sep 17 00:00:00 2001 From: YiFang Xiao Date: Fri, 3 Jan 2025 15:18:46 +0800 Subject: [PATCH] opt: website url placeholder only keep %GDWORD% --- src/common/utils.cc | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/src/common/utils.cc b/src/common/utils.cc index b431e2fd9..6131cb473 100644 --- a/src/common/utils.cc +++ b/src/common/utils.cc @@ -5,7 +5,6 @@ #include #include #include -#include using std::string; namespace Utils { @@ -126,46 +125,6 @@ QString urlReplaceWord( const QString url, QString inputWord ) urlString.replace( "%25GDWORD%25", inputWord.toUtf8().toPercentEncoding() ); - QTextCodec * codec = QTextCodec::codecForName( "Windows-1251" ); - if ( codec ) { - urlString.replace( "%25GD1251%25", codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - codec = QTextCodec::codecForName( "Big-5" ); - if ( codec ) { - urlString.replace( "%25GDBIG5%25", codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - codec = QTextCodec::codecForName( "Big5-HKSCS" ); - if ( codec ) { - urlString.replace( "%25GDBIG5HKSCS%25", codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - codec = QTextCodec::codecForName( "Shift-JIS" ); - if ( codec ) { - urlString.replace( "%25GDSHIFTJIS%25", codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - codec = QTextCodec::codecForName( "GB18030" ); - if ( codec ) { - urlString.replace( "%25GDGBK%25", codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - - // Handle all ISO-8859 encodings - for ( int x = 1; x <= 16; ++x ) { - codec = QTextCodec::codecForName( QString( "ISO 8859-%1" ).arg( x ).toLatin1() ); - if ( codec ) { - urlString.replace( QString( "%25GDISO%1%25" ).arg( x ).toUtf8(), - codec->fromUnicode( inputWord ).toPercentEncoding() ); - } - - // Skip encodings 11..12, they don't exist - if ( x == 10 ) { - x = 12; - } - } - return urlString; } } // namespace Utils::WebSite