diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-22 20:24:02 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-01-23 11:02:47 +0000 |
commit | 6ff57262f44843ccd1f320426984b5e074e3eaf1 (patch) | |
tree | 76fab1ef2dc6b52f7afce218e762b8d2e27cb713 /sw | |
parent | da55a0e5158e14c3743b186d3b1d4022a278e4d5 (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ascii/parasc.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/basflt/iodetect.cxx | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index b3c75f625b85..0256f782fc30 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 1ab3626fe2a1..6522a92045af 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -369,7 +369,7 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen, if (pLineEnd) *pLineEnd = eLineEnd; - return !bIsBareUnicode && eSysLE == eLineEnd; + return !bIsBareUnicode; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |