Help! Character confusion?! A [BUG]?
arning at charm.net
Tue Apr 9 22:38:27 UTC 2002
On Tue, 9 Apr 2002 23:00:07 +0100 "Sean Charles" <scharles at nildram.co.uk> wrote:
>I noticed that after calling String>>asHtml and previewing the *real* web
>browser page, the following characters came out incorrectly:
>123456 comes out as 123 superscripted, 456 as normal i.e.
> 456 sort of thing, and...
>abcd....xyz comes out as abcd...x'y-accute'z.
>I have stared and stared at the code but it's all going fuzzy. Help please!
>The quick way to see the problems are to do a print-it on:
>'xyz' asHtml --> gives --> 'xýz'
>'123456' asHtml --> gives --> '¹²³456'
It's a bug, IMHO. The same table is used to translate in both directions. Replacing 'ý' with 'y' may be reasonable. Replacing a 'y' with 'ý' isn't. Try the change below.
'From Squeak3.3alpha of 28 January 2002 [latest update: #4817] on 9 April 2002 at 6:35:10 pm'!
!String methodsFor: 'converting' stamp: 'RAA 4/9/2002 18:35'!
"Do the basic character conversion for HTML. Leave all original return
and tabs in place, so can conver back by simply removing bracked
things. 4/4/96 tk"
| temp ignores |
ignores _ Set new.
addAll: ($a to: $z);
addAll: ($A to: $Z);
addAll: ($0 to: $9).
temp _ self copyReplaceAll: '&' with: '&'.
[:entity :char |
(ignores includes: char) ifFalse:
[temp _ temp copyReplaceAll: char asString with: '&' , entity , ';']].
temp _ temp copyReplaceAll: ' ' with: ' <IMG SRC="tab.gif" ALT=" ">'.
temp _ temp copyReplaceAll: '
' with: '
More information about the Squeak-dev