|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-07 01:56 UTC] a1593 at ma dot ks dot edu dot tw
/*
This is a bug fix for rfc1867.c
try to upload file from win2k with name C:\DISK0\?\?\.txt
the original code get name as '.ext' which should be '?\?\.txt'.
the following modify is necessary to for client using charset=BIG5.
thanks PHP.
lai a1593@ma.ks.edu.tw
*/
-----------code modified----------------------
//s = strrchr(filenamebuf, '\\');
for (s=filenamebuf+strlen(filenamebuf)-1;s>filenamebuf;s--) {
if (*s=='\\' && *(s-1)>0) break;
}
----------code modified end -------------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
the following code works well for chinese double-byte checking. -----------code modified---------------------- //s = strrchr(filenamebuf, '\\'); char *tmps; for (tmps=filenamebuf;*tmps;tmps++) { if (*tmps<0){// *tmps>127, looks like 2 bytes of chinese code if (!*(tmps+1)) tmps++; contonue; } if (*tmps=='\\') s=tmps; } ----------code modified end ------------------------------code modified---------------------- //s = strrchr(filenamebuf, '\\'); char *tmps; s=filenamebuf; // set initial value for (tmps=filenamebuf;*tmps;tmps++) { if (*tmps<0){// *tmps>127, looks like 2 bytes of chinese code if (!*(tmps+1)) tmps++; continue; } if (*tmps=='\\') s=tmps; } ----------code modified end -------------------anyway, i hope this is the final post about this issue. ---------------------------------------------- s = strrchr(filenamebuf, '\\'); tmps=filenamebuf; while (!(*tmps==NULL)) { if (!(*tmps>0 && *tmps<160)) {//looks like a chinese word if (!*(tmps+1)==NULL) tmps++; } else { if (*tmps=='\\') s=tmps; } tmps++; } -----------------------------------------------