Jump to content

No Unicode / System Locale Dependency for Web API SubPath


Chintaran

Recommended Posts

uTorrent Version: 3.3.2.29806 (also with older versions)

OS: Windows 7 x64 Ultimate (also tested with Windows 7 x86 Enterprise)

Although the uTorrent Windows UI (Add Torrent (choose save dir)...) works flawlessly with non ASCII/Unicode characters in the folder path, the Web API still dependent on the currently configured system locale of the Windows (for non-unicode applications) therefore it's not possible to use any subpath which can't be translated to the current locale.

Example:

1. Windows is configured to use Japanese for non-Unicode applications (eg. code page will be shift-jis).

2. The following request sent to uTorrent: http://localhost:7777/gui/?path=Temp%5cテスト&token=vhez0VXg3Xqx3TM9eZqEoB1UaJiNfOo0WW6B_bkNW4MIkqIE4PH1Z-VL2lEAAAAA&act

=add-url&s=http://releases.ubuntu.com/13.04/ubuntu-13.04-desktop-amd64.iso.torrent&download_dir=3

Response: {"build":29806}

Result: Torrent added to the queue but instead of the expected path ("Temp\テスト") it's a garbled path due to the utf-8/unicode encoding misinterpretation.

If I send a request with the path urlencoded as a shift-jis text: http://localhost:7777/gui/?path=Temp%5c%83e%83X%83g&token=3pdwMCDQjk3rP-HGeg3OBpXozSjUR476ypj5vzOHQPVL_afH6TeAm9ZK2lEAAAAA&

action=add-url&s=http://releases.ubuntu.com/13.04/ubuntu-13.04-desktop-amd64.iso.torrent&download_dir=3

The path will be correctly created with the Japanese characters.

Unfortunately with this problem it's not possible to use any characters in the path which is not in the current locale (for example use Korean folder name on a Windows with Japanese system locale).

A possible workaround would be to add every single folder as a predefined download directory, but unfortunately I would like to use the Web API capabilities in a multilingual scripting scenario where I can't define every possible paths preliminary and can't limit the usage for one language.

Thank you

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...