From 5769851b4cbf1985004ab35bafd5ee69773b8db1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 9 Apr 2020 18:31:36 +0100 Subject: Error strings are not guaranteed to be ASCII MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g., it happened to be this string with Cyrillic characters in my testing: SSL handshake failed: Удаленный хост принудительно разорвал существующее подключение. Change-Id: I4721560412ab6543206cd13c8729dc8cc851eefd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91905 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- ucb/source/ucp/webdav-neon/NeonSession.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 46a60b4d179e..c178c1e90238 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1826,8 +1827,8 @@ void NeonSession::HandleError( int nError, case NE_ERROR: // Generic error { - OUString aText = OUString::createFromAscii( - ne_get_error( m_pHttpSession ) ); + const char* sErr = ne_get_error(m_pHttpSession); + OUString aText(sErr, strlen(sErr), osl_getThreadTextEncoding()); sal_uInt16 code = makeStatusCode( aText ); @@ -1987,9 +1988,9 @@ void NeonSession::HandleError( int nError, default: { SAL_WARN( "ucb.ucp.webdav", "Unknown Neon error code!" ); + const char* sErr = ne_get_error(m_pHttpSession); throw DAVException( DAVException::DAV_HTTP_ERROR, - OUString::createFromAscii( - ne_get_error( m_pHttpSession ) ) ); + OUString(sErr, strlen(sErr), osl_getThreadTextEncoding()) ); } } } -- cgit