Problem with GRCodec

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

Problem with GRCodec

Holger Kleinsorgen-4
Hello,

the following code works with Squeak, but not with VisualWorks:

codec := GRCodec forEncoding: 'UTF-8'.
stream := codec encoderFor: (WriteStream on: (String new)).
stream nextPutAll: '<?xml version="1.0" encoding="utf-8"?>'.

-->

Unhandled exception: Strings only store Characters
ByteString(Object)>>error:
ByteString>>at:put:
WriteStream(InternalStream)>>pastEndPut:
WriteStream>>nextPut:
UTF8StreamEncoder>>write:on:
EncodedStream>>nextPut:
EncodedStream(Stream)>>next:putAll:startingAt:
EncodedStream(Stream)>>nextPutAll:
Grease.GRGenericCodecStream>>nextPutAll:


<--

Looks like VW expects a binary stream. But Squeak expects a character
stream and fails when a binary stream is used.

The following code works and returns a String:

  (GRCodec forEncoding: 'UTF-8') encode: 'Hello'
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc