Use array encoding for non-UTF-8 strings in marshal. Fixes #4779.
This commit is contained in:
parent
0531658c00
commit
e26f9cb665
2 changed files with 33 additions and 29 deletions
|
|
@ -1,5 +1,7 @@
|
|||
discard """
|
||||
output: '''{"age": 12, "name": "Cletus"}'''
|
||||
output: '''{"age": 12, "bio": "\u042F Cletus", "blob": [65, 66, 67, 128], "name": "Cletus"}
|
||||
true
|
||||
true'''
|
||||
"""
|
||||
|
||||
import marshal
|
||||
|
|
@ -72,6 +74,12 @@ type
|
|||
|
||||
Person = object of Entity
|
||||
age: int
|
||||
bio: string
|
||||
blob: string
|
||||
|
||||
var instance1 = Person(name: "Cletus", age: 12)
|
||||
var instance1 = Person(name: "Cletus", age: 12,
|
||||
bio: "Я Cletus",
|
||||
blob: "ABC\x80")
|
||||
echo($$instance1)
|
||||
echo(to[Person]($$instance1).bio == instance1.bio)
|
||||
echo(to[Person]($$instance1).blob == instance1.blob)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue