Manuscript (Caso [Issue]21712) Tools - String conversions into ByteArray

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Manuscript (Caso [Issue]21712) Tools - String conversions into ByteArray

Pharo Issue Tracker
Manuscript Notification
avatar
Pablo Tesone resolved Case 21712: String conversions into ByteArray and assigned it to bstjean:
Bug in Project:  Tools: 1. Pharo Image  •  You are subscribed to this case
This is not an issue.

The first ByteArray is correctly encoded in uft8.
You can get the same result evaluating.

'Les élèves français' asUTF8Bytes.

or

ZnUTF8Encoder new encodeString: 'Les élèves français'

The second ByteArray is the Latin-1 encoding of the same String.
'Les élèves français' asByteArray returns this byte array, but this is a just a coincidence, as this depends in a set of many things. Starting the asByteArray uses the code point of the character and tries to put it in the resulting ByteArray.

You should never convert Strings to ByteArray (or back) without using an encoding.

The inspector is trying to do the best to recognize some data in the ByteArray to show it, so it tries with two common encoding (latin-1 and UTF8).

The second ByteArray is not properly encoded in UTF8, so it is ok not to show.

Please refer to the documentation of ZnEncoders or general String Encoding techniques.
If there is any doubt please ask in the mailing list.
Status changed:
Work Needed  changed to  Resolved (Won't Fix)

Assigned To changed:
Everyone  changed to  bstjean

Priority Priority: 5 – Fix If Time Status Status: Resolved (Won't Fix)
Assigned To Assigned to: bstjean Milestone Milestone: Later

Go to Case
No longer need updates? Unsubscribe from this case.

Don't want Manuscript notifications anymore? Update your preferences.

Manuscript

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
https://lists.gforge.inria.fr/mailman/listinfo/pharo-bugtracker