Project

General

Profile

Actions

Bug #9699

closed

Cannot require .so file on Windows if the file path is unicode (Includes patch)

Added by BugraB (Bugra Barin) almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Assignee:
Target version:
ruby -v:
2.0.0 and later
[ruby-core:61845]

Description

It doesn't seem possible to load a C extension that is inside a non-ascii path.
To reproduce:

  • Extract the attached zip file (with a decent unzip program such as 7-zip, that preserves unicode paths)
  • cd to where you extracted
  • launch irb
  • require './foo.rb' (All this does is require a simple so file inside the folder 'てすと')
  • You'll see a failure

The culprit is in function dln_load, it uses the ANSI version of LoadLibrary and passes in the char* path given to the function. My patch converts it to wide char and uses LoadLibraryW. I have assumed that the given path is UTF-8 encoded, which seems to work but I am not sure if this is a safe assumption.

I hope the patch is in the right format, I wasn't sure. Thanks for your time!
Bugra


Files

require_so_bug_win32.zip (16.3 KB) require_so_bug_win32.zip rb and so file to reproduce the issue BugraB (Bugra Barin), 04/03/2014 08:39 PM
dln_load.patch (1.41 KB) dln_load.patch BugraB (Bugra Barin), 04/03/2014 08:41 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #8676: ruby 2.0 can not require or load the source file with non-ascii path nameClosed07/24/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0