回答編集履歴
1
修正。
test
CHANGED
@@ -12,11 +12,19 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
let s
|
15
|
+
let unicodes = utf8.components(separatedBy: "\\U")
|
16
16
|
|
17
|
-
.filter {!$0.isEmpty}
|
17
|
+
.filter {!$0.isEmpty}
|
18
18
|
|
19
|
-
.map {UInt8($0, radix: 16) ?? 0}
|
19
|
+
.map {UInt8($0, radix: 16) ?? 0}
|
20
|
+
|
21
|
+
print(unicodes)
|
22
|
+
|
23
|
+
//=> [230, 151, 165, 230, 156, 172]
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
let str = String(bytes: unicodes, encoding: .utf8) ?? "(error)"
|
20
28
|
|
21
29
|
print(str)
|
22
30
|
|