Snippets code from my daily experience

July 24, 2010

nsIProcess now works with Unicode

Filed under: nsIProcess,unicode — dafi @ 5:55 pm

In the past I’ve spoken about my problems passing Unicode arguments to, due to these problems I’ve created the IWinProcess component.

Yesterday I’ve discovered that Firefox 4.0b2 is shipped with a revisited nsIProcess implementation containing two new awesome scriptable methods: runw() and runwAsync() (the ‘w’ stays for wide string).

These methods have identical run() and runAsync() signatures but they accept UTF-16 strings as arguments.

I’ve modified my extension to call runw() instead of run() and everything worked like a charm, also the process name (ie the program to launch) can contain Unicode characters, this is a rare case but run() never worked with similar insane scenarios (IWinProcess supports Unicode also on program name).

New methods are very welcomed considering IWinProcess needs to be modified to work with the new XPCOM Registration mechanism and I’ve not enough energies/time/skill to make it compatible with Gecko 2.x.

IWinProcess can be dropped in flavor of native runw()/runwAsync() but to be sure I prefer to wait news from Gecko team and I hope to see soon the nsIProcess page on MDN documenting these new methods.


  1. […] This post was mentioned on Twitter by Kazé and NOSE Takafumi, Davide. Davide said: nsIProcess now works with Unicode: […]

    Pingback by Tweets that mention nsIProcess now works with Unicode « Snippets code from my daily experience -- — July 24, 2010 @ 7:59 pm

  2. It seems to be Bug 411511.

    And actually I wrote a JS-ctype implementation to fix this problem on Windows. 😛

    Comment by Littlebtc — July 24, 2010 @ 8:09 pm

    • There are many bugs related to Unicode and nsIProcess enhancement, a JS-type implementation sounds very cool but if Firefox 4 will support a way directly from nsIProcess it is better for me.
      I would implement a JS-type version including piping and standard output (stdout/stderr) capture, standard input (stdin) is not critical for me at this time

      Comment by dafi — July 25, 2010 @ 7:07 am

  3. MDC docs are a community effort, can I get you to update them? I probably won’t have the time.

    Comment by Benjamin Smedberg — July 24, 2010 @ 9:08 pm

    • I can update the doc but I must be sure the new methods will be publicly available 😉

      Comment by dafi — July 25, 2010 @ 7:02 am

  4. Thanks for pointing this out, I’ve updated MDC.

    Comment by Simon — July 26, 2010 @ 3:46 pm

RSS feed for comments on this post.

Create a free website or blog at

%d bloggers like this: