Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
79de2215
Commit
79de2215
authored
Apr 05, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve_xml_special_chars handles non-ASCII Unicode code points
parent
7f7fc9ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
12 deletions
+31
-12
src/text/strings.c
src/text/strings.c
+31
-12
No files found.
src/text/strings.c
View file @
79de2215
...
...
@@ -384,23 +384,42 @@ void resolve_xml_special_chars( char *psz_value )
{
if
(
*
psz_value
==
'&'
)
{
const
char
*
psz_value1
=
psz_value
+
1
;
if
(
*
psz_value1
==
'#'
)
{
if
(
psz_value
[
1
]
==
'#'
)
{
/* &#xxx; Unicode code point */
char
*
psz_end
;
int
i
=
strto
l
(
psz_value
+
2
,
&
psz_end
,
10
);
unsigned
long
cp
=
strtou
l
(
psz_value
+
2
,
&
psz_end
,
10
);
if
(
*
psz_end
==
';'
)
{
if
(
i
>=
32
&&
i
<=
126
)
psz_value
=
psz_end
+
1
;
if
(
cp
==
0
)
(
void
)
0
;
/* skip nuls */
else
if
(
cp
<=
0x7F
)
{
*
p_pos
=
cp
;
}
else
/* Unicode code point outside ASCII.
* &#xxx; representation is longer than UTF-8 :) */
if
(
cp
<=
0x7FF
)
{
*
p_pos
=
(
char
)
i
;
psz_value
=
psz_end
+
1
;
*
p_pos
++
=
0xC0
|
(
cp
>>
6
)
;
*
p_pos
=
0x80
|
(
cp
&
0x3F
)
;
}
else
if
(
cp
<=
0xFFFF
)
{
/* Unhandled code, FIXME */
*
p_pos
=
*
psz_value
;
psz_value
++
;
*
p_pos
++
=
0xE0
|
(
cp
>>
12
);
*
p_pos
++
=
0x80
|
((
cp
>>
6
)
&
0x3F
);
*
p_pos
=
0x80
|
(
cp
&
0x3F
);
}
else
if
(
cp
<=
0x1FFFFF
)
/* Outside the BMP */
{
/* Unicode stops at 10FFFF, but who cares? */
*
p_pos
++
=
0xF0
|
(
cp
>>
18
);
*
p_pos
++
=
0x80
|
((
cp
>>
12
)
&
0x3F
);
*
p_pos
++
=
0x80
|
((
cp
>>
6
)
&
0x3F
);
*
p_pos
=
0x80
|
(
cp
&
0x3F
);
}
}
else
...
...
@@ -411,10 +430,10 @@ void resolve_xml_special_chars( char *psz_value )
}
}
else
{
{
/* Well-known XML entity */
const
struct
xml_entity_s
*
ent
;
ent
=
bsearch
(
psz_value1
,
xml_entities
,
ent
=
bsearch
(
psz_value
+
1
,
xml_entities
,
sizeof
(
xml_entities
)
/
sizeof
(
*
ent
),
sizeof
(
*
ent
),
cmp_entity
);
if
(
ent
!=
NULL
)
...
...
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