Daniel Wang | 4 Sep 02:08 2005
Picon

something wrong with filename

I try add the following code into dump_torrent and windows client to show chinese files correctly.
but I was defeated.
should I switch file.cpp backto file_win.cpp?
-------------------------------------------------------------------------------
1.
utf8_native(i->path.string());
 
2.
 std::string utf8_native(std::string const& s)
 {
  try
  {
   std::wstring ws;
   libtorrent::utf8_wchar(s, ws);
   std::size_t size = wcstombs(0, ws.c_str(), 0);
   if (size == std::size_t(-1)) return s;
   std::string ret;
   ret.resize(size);
   size = wcstombs(&ret[0], ws.c_str(), size + 1);
   if (size == wchar_t(-1)) return s;
   ret.resize(size);
   return ret;
  }
  catch(std::exception)
  {
   return s;
  }
 }

Start your day with Yahoo! - make it your home page
Cory Nelson | 4 Sep 02:42 2005
Picon

Re: something wrong with filename

There's a good chance that your current locale doesn't support
chinese, so wcstombs() might not work as expected.

On 9/3/05, Daniel Wang <btvampirex <at> yahoo.com.cn> wrote:
> I try add the following code into dump_torrent and windows client to show
> chinese files correctly. 
> but I was defeated. 
> should I switch file.cpp backto file_win.cpp? 
> -------------------------------------------------------------------------------
> 1. 
> utf8_native(i->path.string()); 
>   
> 2. 
>  std::string utf8_native(std::string const& s)
>  {
>   try
>   {
>    std::wstring ws;
>    libtorrent::utf8_wchar(s, ws);
>    std::size_t size = wcstombs(0, ws.c_str(), 0);
>    if (size == std::size_t(-1)) return s;
>    std::string ret;
>    ret.resize(size);
>    size = wcstombs(&ret[0], ws.c_str(), size + 1);
>    if (size == wchar_t(-1)) return s;
>    ret.resize(size);
>    return ret;
>   }
>   catch(std::exception)
>   {
>    return s;
>   }
>  }
> 
>  ________________________________
>  Start your day with Yahoo! - make it your home page 

--

-- 
Cory Nelson
http://www.int64.org

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
MooPolice | 4 Sep 09:16 2005
Picon

Re: something wrong with filename

> 
> I try add the following code into dump_torrent and windows client to show chinese files correctly.
> but I was defeated.

btw, here is what i wrote in the irc chan, short time after you quit ..

<MassaRoddel> here is a solution for windows xp
<MassaRoddel> you can redirect the output into a file
<MassaRoddel> and open it with notepad and choose utf8 encoding
<MassaRoddel> then the file names look ok (for those utf8 encoded)

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Arvid Norberg | 4 Sep 15:46 2005
Picon
Picon

Re: something wrong with filename


On Sep 4, 2005, at 02:08, Daniel Wang wrote:

> I try add the following code into dump_torrent and windows client  
> to show chinese files correctly.
> but I was defeated.
> should I switch file.cpp backto file_win.cpp?

Did all of the torrents you tried fail? If not, my guess is that  
those that failed do not encode their strings in utf-8 or they don't  
have ".utf-8" versions of their strings. I've already added support  
for the non-standard ".utf-8" keys in .torrent files, mostly because  
I've got the impression that it's very common with torrents that  
encode the ordinary strings incorrectly, in some locale-dependent  
encoding, but add the utf-8 versions too.

I'm reluctant to support arbitrary encodings by looking at the  
encoding key, mostly because it's hassle and also non-standard. So,  
if the torrent does not encode the strings correctly, and don't  
provide a utf-8 version, then it will fail.

Could you confirm this by looking in the torrent files that fails for  
you and make sure they don't have .utf-8 versions of the strings?

Among torrents you sent me a few days ago along with screenshots of  
your output, all that failed for you worked for me, and those that  
worked for you failed for me. This was because those who worked for  
you happend to be encoded in the same code page that you have on your  
local system. They contain the following key:

[codepage]   936

And none of the strings are encoded with utf-8. When you added that  
code you posted to the dump_torrent sample, you should get the same  
result as me (as long as the characters used fit in the codepage  
you're using). Since the terminal in windows doesn't take utf-8, it  
would probably be better if you would convert the strings to  
std::wstring and print them to std::wcout. I believe the windows  
terminal would accept utf-16 then, and then it would work with  
characters outside your local codepage too.

--
Arvid Norberg

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Cory Nelson | 4 Sep 23:01 2005
Picon

x64 Edition

Hey guys,  I just put out Arctic Torrent x64 Edition, using libtorrent
of course :)

I'm pretty sure I mentioned this before but I'm not sure if anyone
responded- libtorrent does not build out of the box on VC++ 2005.  You
need to change entry::sort() to:

bool sortpred(const std::pair<std::string,libtorrent::entry> &left,
const std::pair<std::string,libtorrent::entry> &right)
{
   return left.first < right.first;
}

void entry::sort()
{
   dict().sort(sortpred);
}

--

-- 
Cory Nelson
http://www.int64.org

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Arvid Norberg | 4 Sep 23:05 2005
Picon
Picon

Re: x64 Edition

On Sep 4, 2005, at 23:01, Cory Nelson wrote:
> Hey guys,  I just put out Arctic Torrent x64 Edition, using libtorrent
> of course :)

Nice.

> I'm pretty sure I mentioned this before but I'm not sure if anyone
> responded- libtorrent does not build out of the box on VC++ 2005.  You
> need to change entry::sort() to:
>
> bool sortpred(const std::pair<std::string,libtorrent::entry> &left,
> const std::pair<std::string,libtorrent::entry> &right)
> {
>    return left.first < right.first;
> }
>
> void entry::sort()
> {
>    dict().sort(sortpred);
> }

Yeah, sorry, I forgot about this, I'll fix it.

--
Arvid Norberg

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Mike McKay | 8 Sep 14:29 2005

BSD License question

A few weeks ago I asked about the stability of libtorrent in light of 
putting it into production. Also, before launching, I need to make sure 
that I am understanding the licensing terms correctly. We have added a 
layer of GUI and some other stuff on top of LibTorrent. From what I 
understand of the license, we can redistribute binaries (without source) 
but we have to include the copyright, list of conditions and the 
disclaimer (stuff at top of every source file), in an end user license 
agreement. Is that about right? I guess this question is mostly for Arvid.

Thanks
Mike

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Arvid Norberg | 8 Sep 15:40 2005
Picon
Picon

Re: BSD License question

On Sep 8, 2005, at 14:29, Mike McKay wrote:
> A few weeks ago I asked about the stability of libtorrent in light  
> of putting it into production. Also, before launching, I need to  
> make sure that I am understanding the licensing terms correctly. We  
> have added a layer of GUI and some other stuff on top of  
> LibTorrent. From what I understand of the license, we can  
> redistribute binaries (without source) but we have to include the  
> copyright, list of conditions and the disclaimer (stuff at top of  
> every source file), in an end user license agreement. Is that about  
> right? I guess this question is mostly for Arvid.

That is correct. But you don't necessarily need to put it in the  
EULA. You can put it anywhere in the distribution or documentation.

--
Arvid Norberg

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Darren Li | 8 Sep 23:06 2005
Picon

Who can tell how i can unsubscribe for this mail list

Thanks a lot!

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Arvid Norberg | 8 Sep 23:28 2005
Picon
Picon

Re: Who can tell how i can unsubscribe for this mail list

Go to this page:

https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss

enter your email address at the bottom textbox and press "edit  
options". Enter your password and hit "unsubscribe".

--
Arvid Norberg

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

Gmane