Thread overview
error in URI module
Jul 26, 2003
Mårten Ask
Jul 26, 2003
Walter
Jul 26, 2003
Mårten Ask
Jul 26, 2003
Walter
Aug 10, 2003
Walter
July 26, 2003
The decode() function in the URI module crashes when I try to decode
non-english characters. urldecode() in the urllib works though, so I had to
use that one instead.

That's all.


July 26, 2003
Can you provide a test case? I'd like to fix this. -Walter

"Mårten Ask" <majbritt37@hotmail.com> wrote in message news:bfu6h0$l0$1@digitaldaemon.com...
> The decode() function in the URI module crashes when I try to decode
> non-english characters. urldecode() in the urllib works though, so I had
to
> use that one instead.
>
> That's all.
>
>


July 26, 2003
Well, I tried it again with this code:

import uri;

void main()
{
 char[] path = "/file.exe?name=M%E5rten%20Ask";
 printf(uri.decode(path));
}

which should print:

/file.exe?name=Mårten Ask

but all I get is "Error: URI error". I have no clue why it isn't working.


"Walter" <walter@digitalmars.com> skrev i meddelandet news:bfu79a$189$1@digitaldaemon.com...
> Can you provide a test case? I'd like to fix this. -Walter
>


July 26, 2003
Thanks, I can take it from here. -Walter

"Mårten Ask" <majbritt37@hotmail.com> wrote in message news:bfu8kl$2i1$1@digitaldaemon.com...
> Well, I tried it again with this code:
>
> import uri;
>
> void main()
> {
>  char[] path = "/file.exe?name=M%E5rten%20Ask";
>  printf(uri.decode(path));
> }
>
> which should print:
>
> /file.exe?name=Mårten Ask
>
> but all I get is "Error: URI error". I have no clue why it isn't working.
>
>
> "Walter" <walter@digitalmars.com> skrev i meddelandet news:bfu79a$189$1@digitaldaemon.com...
> > Can you provide a test case? I'd like to fix this. -Walter
> >
>
>


August 10, 2003
"Mårten Ask" <majbritt37@hotmail.com> wrote in message news:bfu8kl$2i1$1@digitaldaemon.com...
> Well, I tried it again with this code:
>
> import uri;
>
> void main()
> {
>  char[] path = "/file.exe?name=M%E5rten%20Ask";
>  printf(uri.decode(path));
> }
>
> which should print:
>
> /file.exe?name=Mårten Ask
>
> but all I get is "Error: URI error". I have no clue why it isn't working.

The error is caused by %E5 being the start of a UTF-8 sequence, but 'r' is not a valid continuation. All continuations for UTF-8 sequences have bit 7 set to 1.