[Seaside] 3.9 and encoding in multipart fields

Avi Bryant avi at dabbledb.com
Thu Apr 26 17:29:51 UTC 2007


On 4/26/07, John Thornborrow <john at pinesoft.co.uk> wrote:

> var _ 'thisisastring' squeakToIso isoToUtf
>
> is the best I can find.

Here's what I use on Squeak 3.7:

Integer>>asUTF8
	^ self <= 16r7F
		ifTrue: [self asCharacter asString]
		ifFalse:
			[self <= 16r7FF
				ifTrue:
					[String
						with: (16rC0 bitOr: (self bitShift: -6)) asCharacter
						with: (16r80 bitOr: (self bitAnd: (16r3F))) asCharacter]
				ifFalse:
					[String
						with: (16rE0 bitOr: (self bitShift: -12)) asCharacter
						with: (16r80 bitOr: ((self bitAnd: 16rFC0) bitShift: -6)) asCharacter
						with: (16r80 bitOr: (self bitAnd: 16r3F)) asCharacter]]


Then you can do things like "247 asUTF8" (which is a division symbol,
for example).

Avi


More information about the seaside mailing list