cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2154627 ] "file" protocol does not work in turkish locale

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 16 Oct 2008 08:27:36 +0000

Bugs item #2154627, was opened at 2008-10-09 10:02
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2154627&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Pascal Terjan (pterjan)
Assigned to: Daniel Stenberg (bagder)
Summary: "file" protocol does not work in turkish locale

Initial Comment:
[pterjan_at_plop tmp]$ curl file:///usr/share/hot-babe/hb01/descr
5
hb01_4.png
hb01_3.png
hb01_2.png
hb01_1.png
hb01_0.png
[pterjan_at_plop tmp]$ LC_ALL=tr curl file:///usr/share/hot-babe/hb01/descr
curl: (1) Protocol file not supported or disabled in libcurl

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-10-16 10:27

Message:
Good call! I modified the function, renamed it and committed a version I
believe may work even for ebcdic now...

----------------------------------------------------------------------

Comment By: Dan Fandrich (dfandrich)
Date: 2008-10-16 00:23

Message:
This fix works for me. But it's going to fail on EBCDIC machines--the
character sequence 'a' through 'z' contains discontinuities.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-10-15 23:47

Message:
OK, I've committed a fix for this that replaces a lot of strcasecmp() calls
to instead use the new internal function that doesn't care about locales
and only does a-z case insensitive checks.

It would be great if you could check the current CVS code or tomorrow's
daily snapshot to see if it works as we want even using Turkish!

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-10-09 22:54

Message:
Funny problem! :-/

I guess that there's simply no C or POSIX function we can use to safely
compare strings case insensitively for all locales. It does seem a bit
weird since this string is english and then 'i' and 'I' are in fact the
same letter with different case.

Some programs seem to refer to a c_strcasecmp() function for this
functionality but I've found no actual implementation to look at yet. I'm a
bit disturbed that we more or less are forced to provide our own
implementation of strcasecmp() due to this mess.

----------------------------------------------------------------------

Comment By: Pascal Terjan (pterjan)
Date: 2008-10-09 20:21

Message:
Yes as far as I know this is expected behavior

Google give me some bugs in a lot of software related to this (pgsql,
apt-get, bison, ...)

For example :
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/80248/comments/32
http://www.nabble.com/dircolors-patch-for-locales-like-Turkish-td8977524.html

See also http://gambasdoc.org/help/api/name/gb.strcasecmp

----------------------------------------------------------------------

Comment By: Dan Fandrich (dfandrich)
Date: 2008-10-09 20:05

Message:
That makes sense. The following program proves it:

// Shows a bug in the 'tr' locale on Mandriva 2008.0
//
#include <stdio.h>
#include <string.h>
#include <locale.h>

int main(void)
{
  setlocale(LC_ALL, "tr");
  if (strcasecmp("i","I"))
    printf("Buggy locale!\n");
  return 0;
}

Are you saying that this is expected and desired behaviour in the Turkish
locale? I assumed at least the ASCII alphanumerics would be untouched by
locale-specific behaviour.

----------------------------------------------------------------------

Comment By: Pascal Terjan (pterjan)
Date: 2008-10-09 19:50

Message:
I call it with the ascii file:// url.

I did not look at the code, but strcasecmp in turkish locale will tell
that FILE and file are different because i and I are not the same letter in
turkish alphabet while they are in all other locales.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-10-09 19:41

Message:
but the word "file" is not turkish, it is english and consists of the ascii
letters (in decimal):

102 105 108 101 (lowercase)

or

70 73 76 69

What do you pass in to curl?

----------------------------------------------------------------------

Comment By: Pascal Terjan (pterjan)
Date: 2008-10-09 19:31

Message:
That's not really surprising that it fails as in Turkish "i" is not
lowercase "I" (there is a i without dot and one with dot, the lowercase of
I being and the uppercase of i being )

----------------------------------------------------------------------

Comment By: Dan Fandrich (dfandrich)
Date: 2008-10-09 19:22

Message:
Very strange. The "file" protocol is obviously available in both cases, so
it must be that somehow the string comparison with strcasecmp is failing,
which would be very odd because "file" is plain ASCII, and it's working for
Daniel. What is the output of "locale" and "locale charmap"?

----------------------------------------------------------------------

Comment By: Pascal Terjan (pterjan)
Date: 2008-10-09 17:19

Message:
[pterjan_at_plop ~]$ LC_ALL=C curl --version
curl 7.19.0 (i586-mandriva-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8h
zlib/1.2.3 libidn/1.10 libssh2/0.18
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
[pterjan_at_plop ~]$ LC_ALL=tr curl --version
curl 7.19.0 (i586-mandriva-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8h
zlib/1.2.3 libidn/1.10 libssh2/0.18
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

----------------------------------------------------------------------

Comment By: Dan Fandrich (dfandrich)
Date: 2008-10-09 17:00

Message:
What is the output of:

LC_ALL=C curl --version

and

LC_ALL=tr curl --version

There should be no protocol differences between locales in curl.

----------------------------------------------------------------------

Comment By: Pascal Terjan (pterjan)
Date: 2008-10-09 14:12

Message:
It fails on any file URL (curl 7.19.0 on Mandriva)

Do you have turkish locale ?

Without it I get :
$ LC_ALL=tr curl file:///tmp/plop
curl: (37) Couldn't open file /tmp/plop

After installing the locale I get :
$ LC_ALL=tr curl file:///tmp/plop
curl: (1) Protocol file not supported or disabled in libcurl

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2008-10-09 10:50

Message:
$ LC_ALL=tr curl file://`pwd`/README

... works fine for me when in the curl source tree root. On Debian Linux.

Is your problem related to exactly what URL you use or does it never work
with file?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2154627&group_id=976
Received on 2008-10-16

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET