How to create Chinese named online folder and file
How to create Chinese named online folder and file
Hi experts,
I need some help .
I tried to create a chinese named folder at my server with the following command ..
CreateFTPDirectory(6, "direct/"+keywordname$) where keywordname$ is a string having Chinese charaters e.g. test 报 报 报
However the folder created online at my server came up with '???' where ? replaces each Chinese character.
and when I ftp
If SendFTPFile(6,recdirect$,"direct/"+keywordname$+"/"+keywordname$+"index.php") the file is also having ??? replacing each Chinese character.
Is there any way to create folders and file using Chinese ? Using PHP online is okay no problem but directly from Purebasic I have this problem.
Can anyone kind expert here help me on this.
Thanks in advance for your help
Warmest regards
Alan
I need some help .
I tried to create a chinese named folder at my server with the following command ..
CreateFTPDirectory(6, "direct/"+keywordname$) where keywordname$ is a string having Chinese charaters e.g. test 报 报 报
However the folder created online at my server came up with '???' where ? replaces each Chinese character.
and when I ftp
If SendFTPFile(6,recdirect$,"direct/"+keywordname$+"/"+keywordname$+"index.php") the file is also having ??? replacing each Chinese character.
Is there any way to create folders and file using Chinese ? Using PHP online is okay no problem but directly from Purebasic I have this problem.
Can anyone kind expert here help me on this.
Thanks in advance for your help
Warmest regards
Alan
Re: How to create Chinese named online folder and file
you didnt mention unicode/ascii, so first is to check that you're compiling in unicode mode in PB
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
How did you see that? If via another desktop app, then that needs to support Unicode - and Unicode font. Or using an online 'Control Panel' provided by your Web Host? Check that they support Unicode (they absolutely should).the folder created online at my server came up with '???' where ? replaces each Chinese character.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to create Chinese named online folder and file
I view the files through filezilla FTP . I have other files/folders in Chinese saved through PHP not Purebasic.IdeasVacuum wrote:How did you see that? If via another desktop app, then that needs to support Unicode - and Unicode font. Or using an online 'Control Panel' provided by your Web Host? Check that they support Unicode (they absolutely should).the folder created online at my server came up with '???' where ? replaces each Chinese character.
My compiler is run under unicode and all the messages viewed before sending to server can be seen as Chinese so the compiler is compiling under Chinese(utf8)
But the end result of the folder and file saved created '?' for each Chinese Character. This goes to any language.
So I wonder how others are saving and sending files to the server and the names can be in utf8 ?
Thanks for your answers Keya and IdeasVacuum
Alan
Re: How to create Chinese named online folder and file
you could also use a packet sniffer like Wireshark to ensure they're being sent ok
Re: How to create Chinese named online folder and file
Actually I am sure it is not sent okay as it is intended to be.. to be Chinese/English/Arabic names as the original file from our computer.Keya wrote:you could also use a packet sniffer like Wireshark to ensure they're being sent ok
it actually is unable to send the utf8 characters over to the server . It sends only normal ascii characters.
Just wonder how others configure it to be able to upload and create folders with names in their mother tongue instead of romanised English characters.
Alan
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
Well in fact, in most cases they actually do use English. It's the same with email addresses - the standards and protocols support Unicode solutions (RFC 6530, RFC 6531, RFC 6532, RFC 6533) but most mail servers simply do not.Just wonder how others configure it to be able to upload and create folders with names in their mother tongue instead of romanised English characters.
However, if connected to the server via FileZilla, you can rmc create a new directory. The window that pops-up does accept UTF8 and so you can have your Chinese folder titles. It might mean that uploads to the folder get tricky, that will need to be tested.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to create Chinese named online folder and file
Yes , i can already do that with filezilla ftp program. Can create rename it etc.IdeasVacuum wrote:Well in fact, in most cases they actually do use English. It's the same with email addresses - the standards and protocols support Unicode solutions (RFC 6530, RFC 6531, RFC 6532, RFC 6533) but most mail servers simply do not.Just wonder how others configure it to be able to upload and create folders with names in their mother tongue instead of romanised English characters.
However, if connected to the server via FileZilla, you can rmc create a new directory. The window that pops-up does accept UTF8 and so you can have your Chinese folder titles. It might mean that uploads to the folder get tricky, that will need to be tested.
But when I used
CreateFTPDirectory(6, "direct/"+keywordname$) where keywordname$ is a string having Chinese charaters e.g. test 报 报 报
the folder created was test ???
This has to do with utf8 setting somewhere at the purebasic program level..
I use the Purebasic compiler and checked the box 'Create unicode executable"
I does show the utf8 characters in the program...only the online create does not work.
Surely some foreign non English countries users must have encountered this issue when using ftp programs.
Regards
Alan
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
I'd say until now, no they haven't because they had to use English. No doubt English will continue to be necessary in the short term but change will come. That change though will not be ubiquitous, multi-national companies for example see English as the neutral language anyway.Surely some foreign non English countries users must have encountered this issue when using ftp programs.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
Code: Select all
InitNetwork()
If OpenFTP(0, url, user, pass, 21)
CreateFTPDirectory(0, "报 报 报")
CloseFTP(0)
Else
MessageRequester("Owch", "FTP connection failed")
EndIf
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to create Chinese named online folder and file
Yes I think so... they forgot about the rest of the world's languages :>)IdeasVacuum wrote:Tried the above snippet and got the same result as you on my server. Unless FileZilla does something clever, such as introducing it's own unicode font, it would seem that PB's CreateFTPDirectory() is ASCII only.Code: Select all
InitNetwork() If OpenFTP(0, url, user, pass, 21) CreateFTPDirectory(0, "报 报 报") CloseFTP(0) Else MessageRequester("Owch", "FTP connection failed") EndIf
What I can do is to send up a file to my server and then use php to create the folder...
Trying it now.
For this to runprogram the php module on my server to get the file , read the chinese content and save it as a folder with Chinese.
Thanks for your time and effort.
Alan
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
So, I'm thinking PB is using API FtpCreateDirectoryA(), so we could try FtpCreateDirectoryW()
....fails the same, folder is named "???"
However, it could be that the string has to be 'massaged' before use.
Code: Select all
#INTERNET_OPEN_TYPE_DIRECT = 1
#INTERNET_SERVICE_FTP = 1
Global.i hOpen, hConn, iPort = 21
Global.s sUrl = "myUrl" ;exclude prefix http:// or ftp://
Global.s sUser = "myUser"
Global.s sPass = "myPass"
Global.s sDir = "可以给"
Prototype.i FtpCreateDirectoryW(hConnect.i, sDir.s)
hOpen = InternetOpen_("FTP", #INTERNET_OPEN_TYPE_DIRECT, #Null$, #Null$, iPort)
If hOpen
hConn = InternetConnect_(hOpen, sUrl, iPort, sUser, sPass, 1, #INTERNET_SERVICE_FTP, 0)
If hConn
If OpenLibrary(0, "wininet.dll")
FtpCreateDir.FtpCreateDirectoryW = GetFunction(0, "FtpCreateDirectoryW")
FtpCreateDir(hConn, sDir)
CloseLibrary(0)
EndIf
InternetCloseHandle_(hConn)
Else
Debug "Connection Failed"
EndIf
InternetCloseHandle_(hOpen)
Else
Debug "Init failed"
EndIf

Last edited by IdeasVacuum on Tue Sep 27, 2016 4:52 pm, edited 1 time in total.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to create Chinese named online folder and file
CreateFTPDirectory() doesn't use FtpCreateDirectoryA/W at all, just winsock commands send/recv
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: How to create Chinese named online folder and file
Possibly the method to get FtpCreateDirectoryW to work is to convert the folder name with MultiByteToWideChar_
Edit: No, that doesn't sound right. As I understand it, WideChar is unicode (UTF16).
Tried changing the prototype thus:
Also tried 'building' the folder name with chars:
.... made no difference.
Edit: No, that doesn't sound right. As I understand it, WideChar is unicode (UTF16).
Tried changing the prototype thus:
Code: Select all
Prototype.i FtpCreateDirectoryW(hConnect.i, sDirName.p-unicode)
Code: Select all
Global.s sDir = Chr(21487) + Chr(20197) + Chr(32473) ;"可以给"
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: How to create Chinese named online folder and file
Maybe the Purebasic development team can help out? It seems that so far it cannot do that.IdeasVacuum wrote:Possibly the method to get FtpCreateDirectoryW to work is to convert the folder name with MultiByteToWideChar_
Edit: No, that doesn't sound right. As I understand it, WideChar is unicode (UTF16).
Tried changing the prototype thus:Also tried 'building' the folder name with chars:Code: Select all
Prototype.i FtpCreateDirectoryW(hConnect.i, sDirName.p-unicode)
.... made no difference.Code: Select all
Global.s sDir = Chr(21487) + Chr(20197) + Chr(32473) ;"可以给"
Meanwhile I used php to do it. ftp a file over with chinese contents , use php to read that and saved the file name in Chinese . it works this way . But then the curiosity is why PB does not allow this.
Alan