blob: e7d0a3fa10c63ea6023cd7b970b55c0535a350ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
Index: tyxml-4.0.0/lib/xml_print.ml
===================================================================
--- tyxml-4.0.0.orig/lib/xml_print.ml
+++ tyxml-4.0.0/lib/xml_print.ml
@@ -154,15 +154,14 @@ module Utf8 = struct
Uutf.String.fold_utf_8
(fun _ _ d ->
match d with
- | `Uchar 34 ->
- Buffer.add_string buffer """
- | `Uchar 38 ->
- Buffer.add_string buffer "&"
- | `Uchar 60 ->
- Buffer.add_string buffer "<"
- | `Uchar 62 ->
- Buffer.add_string buffer ">"
- | `Uchar code ->
+ | `Uchar ucode ->
+ begin
+ match Uchar.to_int ucode with
+ | 34 -> Buffer.add_string buffer """
+ | 38 -> Buffer.add_string buffer "&"
+ | 60 -> Buffer.add_string buffer "<"
+ | 62 -> Buffer.add_string buffer ">"
+ | code ->
let u =
(* Illegal characters in html
http://en.wikipedia.org/wiki/Character_encodings_in_HTML
@@ -181,9 +180,10 @@ module Utf8 = struct
|| code land 0xFFFF = 0xFFFE
|| code land 0xFFFF = 0xFFFF
then (warn:=true; Uutf.u_rep)
- else code
+ else ucode
in
Uutf.Buffer.add_utf_8 buffer u
+ end
| `Malformed _ ->
Uutf.Buffer.add_utf_8 buffer Uutf.u_rep;
warn:=true)
Index: tyxml-4.0.0/ppx/ppx_attribute_value.ml
===================================================================
--- tyxml-4.0.0.orig/ppx/ppx_attribute_value.ml
+++ tyxml-4.0.0/ppx/ppx_attribute_value.ml
@@ -160,7 +160,7 @@ let char ?separated_by:_ ?default:_ loc
let c =
match next decoded with
| None -> Ppx_common.error loc "No character in attribute %s" name
- | Some i when i <= 255 -> Char.chr i
+ | Some i when Uchar.to_int i <= 255 -> Char.chr (Uchar.to_int i)
| Some _ ->
Ppx_common.error loc "Character out of range in attribute %s" name
in
|