shithub: riscv

Download patch

ref: 7ae4e473daef440b3931b315a01245e17b784a8f
parent: 7cc757c3c01e09c73034d8f08226ca1fd34c4e6b
author: cinap_lenrek <[email protected]>
date: Sat Aug 2 10:37:16 EDT 2014

ftpfs: dont convert names to latin when string is valid utf-8

--- a/sys/src/cmd/ip/ftpfs/proto.c
+++ b/sys/src/cmd/ip/ftpfs/proto.c
@@ -1517,14 +1517,17 @@
 {
 	char *p, *to;
 	Rune r;
+	int n;
 
 	if(os == Plan9)
 		return nil;
 
 	/* don't convert if we don't have to */
-	for(p = from; *p; p++)
-		if(*p & 0x80)
+	for(p = from; *p; p += n){
+		n = chartorune(&r, p);
+		if(r == Runeerror)
 			break;
+	}
 	if(*p == 0)
 		return nil;