ftpfs: dont convert names to latin when string is valid utf-8
This commit is contained in:
parent
7cc757c3c0
commit
7ae4e473da
1 changed files with 5 additions and 2 deletions
|
@ -1517,14 +1517,17 @@ fromlatin1(char *from)
|
||||||
{
|
{
|
||||||
char *p, *to;
|
char *p, *to;
|
||||||
Rune r;
|
Rune r;
|
||||||
|
int n;
|
||||||
|
|
||||||
if(os == Plan9)
|
if(os == Plan9)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
/* don't convert if we don't have to */
|
/* don't convert if we don't have to */
|
||||||
for(p = from; *p; p++)
|
for(p = from; *p; p += n){
|
||||||
if(*p & 0x80)
|
n = chartorune(&r, p);
|
||||||
|
if(r == Runeerror)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if(*p == 0)
|
if(*p == 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue