Experimental 3.5-1 VM and multilingual support

Colin Putney cputney at whistler.com
Wed Mar 5 01:26:37 UTC 2003


On Tuesday, March 4, 2003, at 03:00  PM, Ned Konz wrote:

> On Tuesday 04 March 2003 02:40 pm, Colin Putney wrote:
>> On Tuesday, March 4, 2003, at 02:27  PM, Colin Putney wrote:
>>> str _ String streamContents: [:stream | Character allCharacters
>>> do: [:c | stream nextPut: c]]
>>> str allButFirst
>>
>> Oh, I forgot to mention why the call to #allButFirst is necessary.
>> Null characters can't be part of strings cut and pasted between
>> Squeak and Mac OS applications; the null and all subsequent
>> characters are lost. The reason is obvious, and I'm not sure that
>> it's actually a problem, but it's worth noting.
>
> How is the reason obvious? Don't they have a length associated with
> their strings? X11 does, as do most languages (other than C). Even
> C++ (using std::string) can handle strings with embedded NUL
> characters.

Well, I thought it was obvious because C uses NUL-terminated strings, 
and the VM is implemented in C when all is said and done. A quick look 
at the sources seems to bear this out. Transferring a string from the 
Squeak clipboard to the OS involves creating a C string, then wrapping 
it in an NSString using #stringWithCString:. Going the other way 
involves strncpy(), which also considers NUL a terminator.

Note to self: never claim that *anything* is obvious. It's not.

Colin



More information about the Squeak-dev mailing list