diff options
-rw-r--r-- | sc/source/core/tool/interpr7.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index b226717c2935..48a34b3ece36 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -325,7 +325,14 @@ void ScInterpreter::ScEncodeURL() else { aUrlBuf.append( '%' ); - aUrlBuf.append( OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase() ); + OString convertedChar = OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase(); + // RFC 3986 indicates: + // "A percent-encoded octet is encoded as a character triplet, + // consisting of the percent character "%" followed by the two hexadecimal digits + // representing that octet's numeric value" + if (convertedChar.getLength() == 1) + aUrlBuf.append("0"); + aUrlBuf.append(convertedChar); } } PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) ); |