About multibytestring

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

About multibytestring

stephane ducasse
hi all

I'm confused.
I have a MultiByteFileStream which has a MacRomanTextConverter
and I get an error Cannot write wide characters

Do you have any idea of the direction in which I should start to look  
for?
Changing the converter?
Will I lose the encodings of my string?

nextPut: aCharacter toStream: aStream
        | ch |
        aStream isBinary ifTrue: [^aCharacter storeBinaryOn: aStream].
        (ch := aCharacter squeakToMac) asciiValue > 255
                ifTrue:[^self error: 'Cannot write wide characters'].
        aStream basicNextPut: ch.


Reply | Threaded
Open this post in threaded view
|

Re: About multibytestring

Bert Freudenberg
On Jul 7, 2007, at 16:00 , stephane ducasse wrote:

> hi all
>
> I'm confused.
> I have a MultiByteFileStream which has a MacRomanTextConverter
> and I get an error Cannot write wide characters
>
> Do you have any idea of the direction in which I should start to  
> look for?
> Changing the converter?

If you want to write general wide strings, use a UTF-8 converter.

> Will I lose the encodings of my string?

Using a MacRoman converter you can only write those wide characters  
that have a MacRoman encoding.

> nextPut: aCharacter toStream: aStream
> | ch |
> aStream isBinary ifTrue: [^aCharacter storeBinaryOn: aStream].
> (ch := aCharacter squeakToMac) asciiValue > 255
> ifTrue:[^self error: 'Cannot write wide characters'].
> aStream basicNextPut: ch.
>
>

- Bert -