summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2018-06-11 07:59:28 +0200
committerTamás Bunth <btomi96@gmail.com>2018-06-11 10:42:22 +0200
commit647a9fec404ebce898a44de63fcf1b1d6f5036e6 (patch)
tree1b2632fb353631acd4cb5f70ce0313258aa3f165
parentf49d9c7217eb254d8b1fca9c92d22a00470ca579 (diff)
tdf#117115 dbahsql: respect escaped '\'
Change-Id: Id408f7a98011d806f01b6c63ae67008c4dba4b0d Reviewed-on: https://gerrit.libreoffice.org/55595 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Bunth <btomi96@gmail.com>
-rw-r--r--dbaccess/source/filter/hsqldb/createparser.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx
index 9054a2f9bf72..5b864f4231c6 100644
--- a/dbaccess/source/filter/hsqldb/createparser.cxx
+++ b/dbaccess/source/filter/hsqldb/createparser.cxx
@@ -50,15 +50,16 @@ sal_Int32 lcl_IndexOfUnicode(const OString& rSource, const sal_Int32 nFrom = 0)
//Convert ascii escaped unicode to utf-8
OUString lcl_ConvertToUTF8(const OString& rText)
{
+ OString original = rText;
OString sResult = rText;
sal_Int32 nIndex = lcl_IndexOfUnicode(sResult);
while (nIndex != -1 && nIndex < rText.getLength())
{
- const OString sHex = sResult.copy(nIndex + 2, 4);
+ const OString sHex = original.copy(nIndex + 2, 4);
const sal_Unicode cDec = static_cast<sal_Unicode>(strtol(sHex.getStr(), nullptr, 16));
const OString sNewChar = OString(&cDec, 1, RTL_TEXTENCODING_UTF8);
sResult = sResult.replaceAll("\\u" + sHex, sNewChar);
- nIndex = lcl_IndexOfUnicode(sResult, nIndex);
+ nIndex = lcl_IndexOfUnicode(original, nIndex + 1);
}
return OStringToOUString(sResult, RTL_TEXTENCODING_UTF8);
}