<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>72944</bug_id>
          
          <creation_ts>2011-11-22 05:19:15 -0800</creation_ts>
          <short_desc>[Windows, WinCairo] Load from non-ASCII file system path fails</short_desc>
          <delta_ts>2023-12-14 10:35:42 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 7</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Heiner Wolf">wolf.heiner</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>fujii</cc>
    
    <cc>peter</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>507536</commentid>
    <comment_count>0</comment_count>
    <who name="Heiner Wolf">wolf.heiner</who>
    <bug_when>2011-11-22 05:19:15 -0800</bug_when>
    <thetext>My app which uses WebKit-Cairo fails to load from a file:// URL with non-ASCII characters in the path

I verified this to be a WebKit-Cairo problem by modifying WebKit/Tools/WinLauncher/WinLauncher to load from a file path. Works with ASCII only paths. Does not load when I change one ASCII character to a German umlaut (ü) or Japanese Katakana (ホ). I assume non ASCII paths works with Apple libs, hence I point to the Cairo port.

Using this URL:
  L&quot;file://C/ProjDir/test/aホü/NonAsciiPath.html&quot;
as input to
  IWebMutableURLRequest::initWithURL(BSTR)

hits IWebResourceLoadDelegate::didFailLoadingWithError() with 
  localizedDescription=Couldn&apos;t read a file:// file
  failingURL=file://C/ProjDir/test/a%EF%BE%8E%C3%BC/NonAsciiPath.html

The Windows wide chars
  L&quot;aホü&quot;;
are equivalent to UTF-8:
  &quot;a\xef\xbe\x8e\xc3\xbc&quot;
Same as:
  a%EF%BE%8E%C3%BC
The failingURL is basically correct, a URL-encoded UTF-8 of the input.

I observe, that WebKit UTF-8 and URL-encodes the WCHAR URL from IWebMutableURLRequest::initWithURL(BSTR) and feeds it to libcurl [Windows, WinCairo]. I _assume_, that libcurl tries to fopen() the URL-encoded path, which fails. For file:// it would need a back conversion from URL-encode to UTF-8 and UTF-8 to WCHAR, then _wopen. 

If curl is using the ASCII Windows API as I suspect reading
  https://github.com/bagder/curl/blob/7248439fece7d0f32cc3d52c253b3960a66ad2b3/lib/file.c#L344
then we are doomed. This should be _wopen() with a prior ::MultiByteToWideChar() or _curl_win32_UTF8_to_wchar() for that matter.

Maybe someone who knows the inner workings better can comment, before I dig deeper.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>