Skip to content

WAUrlEncoder not using primitive #31

@dalehenrich

Description

@dalehenrich

From Gerhard:

It seems that the gemstone primitve encodeUsing: is not working 
with the WAUrlEncoder table.
The primitive doesn't like nil as entries in the table.

The method table ^table at WATableBaseEncoder must be implemented to be able to run the test.
'asd' encodeUsing: WAUrlEncoder table    .....    always returns nil

I don't have a real patch for this. If the table is initialized with strings only, it seems to work.
But then also the nextPut: method at WATableBasedEncoder must be changed.

e.g.
initializeTable
    "Initializes the encoding table."
    | stream characterLimit |
    characterLimit := self maximumCharacterValue.
    "character values at zero so we need to add 1"
    table := Array new: characterLimit + 1.
    stream := WriteStream on: (String new: 6).
    0 to: characterLimit do: [ :index | 
        | character value |
        character := Character codePoint: index.
        self encode: character on: stream reset.
        "Smalltalk indices are one based but character values start at 0"
        value := stream contents = (String with: character)
            ifTrue: [ (String with: character) ]    .... instead of nil
            ifFalse: [ stream contents ].
        table at: index + 1 put: value ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions