www.digitalmars.com         C & C++   DMDScript  

D - error in URI module

reply "Mårten Ask" <majbritt37 hotmail.com> writes:
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.
Jul 26 2003
parent reply "Walter" <walter digitalmars.com> writes:
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

 use that one instead.

 That's all.

Jul 26 2003
parent reply "Mårten Ask" <majbritt37 hotmail.com> writes:
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

Jul 26 2003
next sibling parent "Walter" <walter digitalmars.com> writes:
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


Jul 26 2003
prev sibling parent "Walter" <walter digitalmars.com> writes:
"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.
Aug 09 2003