[squeak-dev] Strange Char code 160

Ron Teitelbaum ron at usmedrec.com
Tue Sep 11 15:38:41 UTC 2018


Hi All,

I ran into this problem.  Has anyone seen this before?

I was importing a file that contained some sort of char code 160.
http://www.adamkoch.com/2009/07/25/white-space-and-character-160/ says this
is a non-breaking space.

I pasted the character into Squeak. When trying to inspect it in squeak I
get illegal character.

Illegal character (char code 160 16r16rA0) ->

The 16r16r seems to be an error in the method and not a real number

xIllegal
"An illegal character was encountered"
self halt.
self notify: 'Illegal character (char code ' , hereChar charCode , *' 16r'*
, hereChar charCode hex , ')' at: mark

But if I inspect Character nbsp I get a character 160 that seems to work
fine.

Here is the stack.  I added a halt in xIllegal.
'11 September 2018 11:30:40.486 am

VM: Win32 - Smalltalk
Image: Squeak4.1 [latest update: #9957]

Parser(Object)>>halt
Receiver: a Parser
Arguments and temporary variables:

Receiver''s instance variables:
source: a ReadWriteStream
mark: 22
hereChar: $
aheadChar: Character value: 30
token: nil
tokenType: #xIllegal
currentComment: nil
buffer: a WriteStream ''''
typeTable: #(#xIllegal #xIllegal #xIllegal #xIllegal #xIllegal #xIllegal
#xIllegal #xIllegal #xDelimiter #xDelimiter #xIllegal #xDelimiter
#xDelimiter #xIllegal #xIllegal #xIllega...etc...
here: nil
hereType: nil
hereMark: nil
hereEnd: nil
prevMark: nil
prevEnd: nil
encoder: {an EncoderForV3PlusClosures}
requestor: a SmalltalkEditor
parseNode: nil
failBlock: [closure] in
Parser>>parse:class:category:noPattern:context:notifying:ifFail:
requestorOffset: 0
tempsMark: nil
doitFlag: nil
properties: nil
category: nil

Parser(Scanner)>>xIllegal
Receiver: a Parser
Arguments and temporary variables:

Receiver''s instance variables:
source: a ReadWriteStream
mark: 22
hereChar: $
aheadChar: Character value: 30
token: nil
tokenType: #xIllegal
currentComment: nil
buffer: a WriteStream ''''
typeTable: #(#xIllegal #xIllegal #xIllegal #xIllegal #xIllegal #xIllegal
#xIllegal #xIllegal #xDelimiter #xDelimiter #xIllegal #xDelimiter
#xDelimiter #xIllegal #xIllegal #xIllega...etc...
here: nil
hereType: nil
hereMark: nil
hereEnd: nil
prevMark: nil
prevEnd: nil
encoder: {an EncoderForV3PlusClosures}
requestor: a SmalltalkEditor
parseNode: nil
failBlock: [closure] in
Parser>>parse:class:category:noPattern:context:notifying:ifFail:
requestorOffset: 0
tempsMark: nil
doitFlag: nil
properties: nil
category: nil

Parser(Scanner)>>scanToken
Receiver: a Parser
Arguments and temporary variables:

Receiver''s instance variables:
source: a ReadWriteStream
mark: 22
hereChar: $
aheadChar: Character value: 30
token: nil
tokenType: #xIllegal
currentComment: nil
buffer: a WriteStream ''''
typeTable: #(#xIllegal #xIllegal #xIllegal #xIllegal #xIllegal #xIllegal
#xIllegal #xIllegal #xDelimiter #xDelimiter #xIllegal #xDelimiter
#xDelimiter #xIllegal #xIllegal #xIllega...etc...
here: nil
hereType: nil
hereMark: nil
hereEnd: nil
prevMark: nil
prevEnd: nil
encoder: {an EncoderForV3PlusClosures}
requestor: a SmalltalkEditor
parseNode: nil
failBlock: [closure] in
Parser>>parse:class:category:noPattern:context:notifying:ifFail:
requestorOffset: 0
tempsMark: nil
doitFlag: nil
properties: nil
category: nil

Parser(Scanner)>>scan:
Receiver: a Parser
Arguments and temporary variables:
inputStream: a ReadWriteStream

Receiver''s instance variables:
source: a ReadWriteStream
mark: 22
hereChar: $
aheadChar: Character value: 30
token: nil
tokenType: #xIllegal
currentComment: nil
buffer: a WriteStream ''''
typeTable: #(#xIllegal #xIllegal #xIllegal #xIllegal #xIllegal #xIllegal
#xIllegal #xIllegal #xDelimiter #xDelimiter #xIllegal #xDelimiter
#xDelimiter #xIllegal #xIllegal #xIllega...etc...
here: nil
hereType: nil
hereMark: nil
hereEnd: nil
prevMark: nil
prevEnd: nil
encoder: {an EncoderForV3PlusClosures}
requestor: a SmalltalkEditor
parseNode: nil
failBlock: [closure] in
Parser>>parse:class:category:noPattern:context:notifying:ifFail:
requestorOffset: 0
tempsMark: nil
doitFlag: nil
properties: nil
category: nil


--- The full stack ---
Parser(Object)>>halt
Parser(Scanner)>>xIllegal
Parser(Scanner)>>scanToken
Parser(Scanner)>>scan:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Parser>>init:notifying:failBlock:
Parser>>parse:class:category:noPattern:context:notifying:ifFail:
Compiler>>translate:noPattern:ifFail:
Compiler>>evaluate:in:to:notifying:ifFail:logged:
[] in SmalltalkEditor(TextEditor)>>evaluateSelection
BlockClosure>>on:do:
SmalltalkEditor(TextEditor)>>evaluateSelection
[] in PluggableTextMorphPlus(PluggableTextMorph)>>inspectIt
...etc...

And to top it off if I inspect hereChar on xIllegal in the debugger I get a
char 160 that works fine!

I'm not sure how to determine what exactly what is the difference between
the two characters.  Any suggestions?

Thanks!

All the best,

Ron Teitelbaum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180911/746fe7e0/attachment.html>


More information about the Squeak-dev mailing list