summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-01-22 20:24:02 +0200
committerAndras Timar <andras.timar@collabora.com>2017-08-28 19:06:03 +0200
commit5bbd829d75573e9a0e6b4346342e839480bf770a (patch)
treea83acfcdae1a686ccae7ab081c181153d5579908 /sw
parent9d473dd43a1280c8a921dc25c36ee395f3da8633 (diff)
tdf#63673 Never ignore detected BOM
SwIoSystem::IsDetectableText was returning false only because the detected line end isn't the same as the system default one. Instead return true whenever there is a known BOM or at least there is no 0x0, and actually use the detected line end. Change-Id: I20cc1642e7ad2e6e13dfb48c325a00c44f818f15 Reviewed-on: https://gerrit.libreoffice.org/33404 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> (cherry picked from commit 48da72b25b41614efd0689c20ef51ce420d53a70) Signed-off-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ascii/parasc.cxx4
-rw-r--r--sw/source/filter/basflt/iodetect.cxx2
2 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index f6ed774a3c63..e3045b0edee8 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -269,11 +269,13 @@ sal_uLong SwASCIIParser::ReadChars()
sal_uLong nLen, nOrig;
nOrig = nLen = rInput.ReadBytes(pArr, ASC_BUFFLEN);
rtl_TextEncoding eCharSet;
- bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode);
+ LineEnd eLineEnd;
+ bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode, &eLineEnd);
OSL_ENSURE(bRet, "Autodetect of text import without nag dialog must have failed");
if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW)
{
aEmpty.SetCharSet(eCharSet);
+ aEmpty.SetParaFlags(eLineEnd);
rInput.SeekRel(-(long(nLen)));
}
else
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 10c41162fbfc..4409dbfa70d4 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -370,7 +370,7 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen,
if (pLineEnd)
*pLineEnd = eLineEnd;
- return bEncodedFilter || (!bIsBareUnicode && eSysLE == eLineEnd);
+ return bEncodedFilter || !bIsBareUnicode;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */