[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Mon Jan 26 14:18:34 PST 2015


 sc/source/core/tool/interpr7.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 9266abdb548ce99ebd891080fa263e930c5234e1
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jan 26 23:13:46 2015 +0100

    operate on UTF-8 encoded string, tdf#76870 follow-up
    
    Change-Id: I00088a34a41f8adc4204f490fedee434c96bac67

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index a4a8f60..ce69848 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -225,16 +225,18 @@ void ScInterpreter::ScEncodeURL()
             return;
         }
 
-        OStringBuffer aUrlBuf;
-        for ( int i = 0; i < aStr.getLength(); i++ )
+        OString aUtf8Str( aStr.toUtf8());
+        const sal_Int32 nLen = aUtf8Str.getLength();
+        OStringBuffer aUrlBuf( nLen );;
+        for ( int i = 0; i < nLen; i++ )
         {
-            sal_Unicode c = aStr[ i ];
-            if ( rtl::isAsciiAlphanumeric( c ) || c == '-' || c == '_' )
-                aUrlBuf.append( static_cast<sal_Char>( c ) );
+            sal_Char c = aUtf8Str[ i ];
+            if ( rtl::isAsciiAlphanumeric( static_cast<sal_uChar>( c ) ) || c == '-' || c == '_' )
+                aUrlBuf.append( c );
             else
             {
                 aUrlBuf.append( '%' );
-                aUrlBuf.append( OString::number( static_cast<sal_Int32>( c ), 16 ).toAsciiUpperCase() );
+                aUrlBuf.append( OString::number( static_cast<sal_uChar>( c ), 16 ).toAsciiUpperCase() );
             }
         }
         PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) );


More information about the Libreoffice-commits mailing list