divyang4481 / firebreath

Automatically exported from code.google.com/p/firebreath
0 stars 0 forks source link

FB::URI::fromString(durl) fails when durl includes non-ascii characters (for example icelandic) #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

FB::URI uri = 
FB::URI::fromString("https://dev.vm/workspace/file/382e9569-0440-4e27-bd63-88ea5
657c6c0/download/íslenkt-bréf-æðþóúý.doc?xpath=file");

results in exception.

FireBreath 1.4.1
Visual studio 2008

Simple fix:
ScriptingCore/URI.cpp lines 40-42 change to:
        if (c > 0 && (isalnum(c) ||
            c == '$' || c == '-' || c == '_' || c == '.' || c == '!' ||
            c == '*' || c == '\''|| c == '(' || c == ')' || c == ',' || c == '/')) res << c;

Original issue reported on code.google.com by krystian...@gmail.com on 9 Mar 2011 at 4:32

GoogleCodeExporter commented 9 years ago
You can't put unicode characters in a std::string; you need to use a 
std::wstring. try something like this:

std::wstring 
strURI(L"https://dev.vm/workspace/file/382e9569-0440-4e27-bd63-88ea5657c6c0/down
load/íslenkt-bréf-æðþóúý.doc?xpath=file");
FB::URI uri = FB::URI::fromString(FB::utf8_from_wstring(strURI);

see if that works.

Original comment by taxilian on 9 Mar 2011 at 6:03

GoogleCodeExporter commented 9 years ago
I've already tried that and it fails. My fix works for me with icelandic 
characters.

Original comment by krystian...@gmail.com on 9 Mar 2011 at 6:34

GoogleCodeExporter commented 9 years ago
Fixed in both branches.

Original comment by taxilian on 9 Mar 2011 at 7:01