nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c3a9fc
)
lib/standard/bytes: Update bytes::to_s for cleaning purposes
author
Lucas Bajolet
<r4pass@hotmail.com>
Wed, 12 Aug 2015 18:53:01 +0000
(14:53 -0400)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Wed, 12 Aug 2015 18:53:49 +0000
(14:53 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/standard/bytes.nit
patch
|
blob
|
history
diff --git
a/lib/standard/bytes.nit
b/lib/standard/bytes.nit
index
0e71a90
..
52e3b21
100644
(file)
--- a/
lib/standard/bytes.nit
+++ b/
lib/standard/bytes.nit
@@
-145,7
+145,12
@@
class Bytes
redef fun to_s do
persisted = true
- return new FlatString.with_infos(items, length, 0, length -1)
+ var b = self
+ if not is_utf8 then
+ b = clean_utf8
+ persisted = false
+ end
+ return new FlatString.with_infos(b.items, b.length, 0, b.length -1)
end
redef fun iterator do return new BytesIterator.with_buffer(self)