bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] bad filename


From: Ángel González
Subject: Re: [Bug-wget] bad filename
Date: Wed, 23 Apr 2014 16:25:30 +0200
User-agent: Thunderbird

On 23/04/14 15:57, Bykov Aleksey wrote:
Greetings, Darshit Shah
This was disscussed some (or long) time ago.
Possible logic:
If locale isn't UTF-8 then process as before else
1. Convert string to WideCharString with mbstowcs().
2. For Each WideChar check it size with wctomb(). If size is 1 then compare it with mask. 
If char restricted, then "quoted++;"
3. If need, convert to lower/upper case with towlower()/towupper()
4. Recreate string char by char with wctomb: Convert char to temporary buffer. If 
filechar size is 1 compare with mask and repalce. Else "memcpy(q, char_buffer, 
char_size); q+=char_size;"
In windows i can't check it ( mbstowcs didn't work with UTF-8, so must be used 
MultiByteToWideChar()...)
Patch for windows (unstructured, unclear, unfinished, but worked) is attached.
Best Regards, Bykov Aleksey.
Note that the url mihgt not be in utf-8 at all (need to handle mbstowcs() == -1). Your algorithm looks quite good. Why do you need step 3? In which case do you expect needing to change the character case?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]