[squeak-dev] #asOctetString Bug?

patrick.rein at hpi.uni-potsdam.de patrick.rein at hpi.uni-potsdam.de
Fri Jun 14 18:34:23 UTC 2019


Hi everyone,

while working on parsing network data I tried to use asOctetString and noticed that it did not yield a ByteString when called on a WideString. Is this the intendended behavior? I would have expected a behavior similar to the one I documented in the test case below. If not I think that the problem simply originates from using #at: which is overridden by WideString. 

Bests,
Patrick

testAsOctetStringFromWideString

	| rawStringOctet wideStringAsOctet wideString |
	rawStringOctet := #[103 114 252 223 101 "The character 16r1fA02 starts here" 0 1 250 2].
	wideString := 'grüße' , (String value: 16r1FA02).
	wideStringAsOctet := wideString asOctetString asByteArray.
	self assert: rawStringOctet equals: wideStringAsOctet.


More information about the Squeak-dev mailing list