[Pharo-project] Issue 2555: WideString asByteString does not return a ByteString
Reported by nils.winter, Today (2 hours ago) WideString asByteString does not return a ByteString. Pharo image: Pharo Pharo core version: Pharo-1.1-11367-Beta Virtual machine used: Squeak 4.2.4beta1U Class browser used (if applicable): OBSystemBrowserAdaptor Steps to reproduce: 1. 'Ï' asByteString isByteString "false, shouldn't that be true?" Shouldn't that at least fail? I would suspect, that String>>asByteString should be something like asByteString | string | "Convert the receiver into a ByteString" string := ByteString new: self byteSize. 1 to: self byteSize do: [: i | string byteAt: i put: (self byteAt: i)]. ^string (copied that from asOctedString and replaced #size, #at:put: and #at: with their byte-versions ) btw: The display of 'Ï' seems to be broken on 1.1 is displayed as '?? and has some strange cursor issued but functionality is there
On Jun 15, 2010, at 12:09 09PM, Stéphane Ducasse wrote:
Reported by nils.winter, Today (2 hours ago) WideString asByteString does not return a ByteString.
Pharo image: Pharo Pharo core version: Pharo-1.1-11367-Beta Virtual machine used: Squeak 4.2.4beta1U Class browser used (if applicable): OBSystemBrowserAdaptor
Steps to reproduce:
1. 'Ï' asByteString isByteString "false, shouldn't that be true?"
Shouldn't that at least fail? I would suspect, that String>>asByteString should be something like
asByteString | string | "Convert the receiver into a ByteString" string := ByteString new: self byteSize. 1 to: self byteSize do: [: i | string byteAt: i put: (self byteAt: i)]. ^string
(copied that from asOctedString and replaced #size, #at:put: and #at: with their byte-versions )
btw: The display of 'Ï' seems to be broken on 1.1 is displayed as '?? and has some strange cursor issued but functionality is there _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Responded in detail in the issue. Basically, asByteString is a bad name for what it does/should be allowed to do. Zero senders, not sure if we should keep it for backwards-compat or just remove it (asOctetString is more descriptive with the same functionality as current). Either way I added a slice with some better comments explaining its limitations. Cheers, Henry
participants (2)
-
Henrik Johansen -
Stéphane Ducasse