Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
e633c3c5
Commit
e633c3c5
authored
May 29, 2017
by
Sergey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 35012
parent
0f04de34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
Common/DocxFormat/Source/XML/Utils.h
Common/DocxFormat/Source/XML/Utils.h
+65
-0
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+1
-1
No files found.
Common/DocxFormat/Source/XML/Utils.h
View file @
e633c3c5
...
...
@@ -369,6 +369,71 @@ namespace XmlUtils
return
buffer
;
}
AVSINLINE
static
std
::
wstring
EncodeXmlStringExtend
(
const
std
::
wstring
&
data
,
bool
bDeleteNoUnicode
=
false
)
{
std
::
wstring
buffer
;
buffer
.
reserve
(
data
.
size
());
if
(
bDeleteNoUnicode
)
{
for
(
size_t
pos
=
0
;
pos
<
data
.
size
();
++
pos
)
{
switch
(
data
[
pos
])
{
case
'&'
:
buffer
.
append
(
L"&"
);
break
;
case
'\"'
:
buffer
.
append
(
L"""
);
break
;
case
'\''
:
buffer
.
append
(
L"'"
);
break
;
case
'<'
:
buffer
.
append
(
L"<"
);
break
;
case
'>'
:
buffer
.
append
(
L">"
);
break
;
case
'\n'
:
buffer
.
append
(
L"
"
);
break
;
case
'\r'
:
buffer
.
append
(
L"
"
);
break
;
case
'\t'
:
buffer
.
append
(
L"	"
);
break
;
case
160
:
buffer
.
append
(
L" "
);
break
;
default:
{
if
(
false
==
IsUnicodeSymbol
(
data
[
pos
]
)
)
{
wchar_t
symbol1
=
data
[
pos
];
if
(
0xD800
<=
symbol1
&&
symbol1
<=
0xDFFF
&&
pos
+
1
<
data
.
size
())
{
pos
++
;
wchar_t
symbol2
=
data
[
pos
];
if
(
symbol1
<
0xDC00
&&
symbol2
>=
0xDC00
&&
symbol2
<=
0xDFFF
)
{
buffer
.
append
(
&
data
[
pos
-
1
],
2
);
}
}
}
else
buffer
.
append
(
&
data
[
pos
],
1
);
}
break
;
}
}
}
else
{
for
(
size_t
pos
=
0
;
pos
<
data
.
size
();
++
pos
)
{
switch
(
data
[
pos
])
{
case
'&'
:
buffer
.
append
(
L"&"
);
break
;
case
'\"'
:
buffer
.
append
(
L"""
);
break
;
case
'\''
:
buffer
.
append
(
L"'"
);
break
;
case
'<'
:
buffer
.
append
(
L"<"
);
break
;
case
'>'
:
buffer
.
append
(
L">"
);
break
;
case
'\n'
:
buffer
.
append
(
L"
"
);
break
;
case
'\r'
:
buffer
.
append
(
L"
"
);
break
;
case
'\t'
:
buffer
.
append
(
L"	"
);
break
;
case
160
:
buffer
.
append
(
L" "
);
break
;
case
'\0'
:
return
buffer
;
default:
buffer
.
append
(
&
data
[
pos
],
1
);
break
;
}
}
}
return
buffer
;
}
//#ifndef _USE_LIBXML2_READER_
class
CStringWriter
{
...
...
X2tConverter/src/cextracttools.h
View file @
e633c3c5
...
...
@@ -544,7 +544,7 @@ namespace NExtractTools
}
sRes
=
L"<xmlOptions><fileOptions fileType='"
+
std
::
to_wstring
(
nFileType
);
sRes
+=
L"' codePage='"
+
std
::
to_wstring
(
nCsvEncoding
);
sRes
+=
L"' delimiter='"
+
XmlUtils
::
EncodeXmlString
(
cDelimiter
)
+
L"' "
+
sSaveType
;
sRes
+=
L"' delimiter='"
+
XmlUtils
::
EncodeXmlString
Extend
(
cDelimiter
)
+
L"' "
+
sSaveType
;
sRes
+=
L"/><TXTOptions><Encoding>"
+
std
::
to_wstring
(
nCsvEncoding
)
+
L"</Encoding></TXTOptions></xmlOptions>"
;
return
sRes
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment