This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: stat() lstat() not able to read long filename with cyrillic chars?
- From: Denis Corbin <dar dot linux at free dot fr>
- To: cygwin at cygwin dot com
- Date: Sat, 26 Dec 2015 22:57:21 +0100
- Subject: Re: stat() lstat() not able to read long filename with cyrillic chars?
- Authentication-results: sourceware.org; auth=none
- References: <20151223194440 dot 5B2A98CFEA at edrusb dot is-a-geek dot org> <20151224192448 dot GB4275 at calimero dot vinschen dot de> <773876572 dot 20151225030451 at yandex dot ru>
On 25/12/2015 01:04, Andrey Repin wrote:
> Greetings, Corinna Vinschen!
>
>>> First, I have read the FAQ and this mailing archive :)
>>>
[..]
>
>> NAME_MAX is 255. On Windows this is the number of UTF-16 chars
>> unfortunately. On POSIX systems (as on Cygwin) this is the
>> number of bytes. Long UTF-16 strings in cyrillic take twice as
>> much UTF-8 chars as it has UTF-16 chars, so NAME_MAX in utf-8
>> cyrillics translates into a maximum of 127 UTF-16 chars.
Ok, I understand. Thanks for your explanation.
>
> Aren't POSIX restrictions are a bit different? Namely 128 bytes
> per path element and 4096 bytes for file name?
Seen the sample file name it seems truncated rather near 256 bytes (~
128 UTF-16 chars) than 4096 bytes...
>
>> If you need access to UTF-16 filenames with more characters, you
>> can switch to a one-byte charset temporarily, e.g.
>
>> $ LC_ALL=ru_RU your_app
>
>> to switch to iso-8859-5 or
>
>> $ LC_ALL=ru_RU.CP1251
>
>> to switch to Windows codepage 1251. See
>> https://cygwin.com/cygwin-ug-net/setup-locale.html
>
>
>> HTH, Corinna
>
>
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple