久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Ftp 創建帶有 utf-8 字符的文件名,例如希臘語、德

Ftp create a filename with utf-8 chars such as greek, german etc(Ftp 創建帶有 utf-8 字符的文件名,例如希臘語、德語等)
本文介紹了Ftp 創建帶有 utf-8 字符的文件名,例如希臘語、德語等的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試使用以下代碼將文件創建到 ftp 服務器(我也嘗試使用 UseBinary 選項 true 和 false)

I am trying to create a file to an ftp server with the following code (where I also tried with UseBinary option true and false)

string username = "name";
string password = "password";
string remotefolder = "ftp://ftp.myhost.gr/public_html/test/";
string remoteFileName = "δοκιμαστικ? αρχε?οü?-?Copy.txt";
string localFile = @"C:	estδοκιμαστικ? αρχε?ο - Copy.txt";
String ftpname = "ftp://ftp.myhost.gr/public_html/test" + @"/" + Uri.EscapeUriString(Program.remoteFileName);


FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpname);
request.Proxy = null;
request.Credentials = new NetworkCredential(username, password);


request.UsePassive = true;
request.KeepAlive = true;
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UseBinary = true;
//request.UseBinary = false;

 byte[] content = System.IO.File.ReadAllBytes(localFile);
 byte[] fileContents = new Byte[content.Length];

 Array.Copy(content, 0, fileContents, 0, content.Length);

 using (Stream uploadStream = request.GetRequestStream())
 {
     int contentLength = fileContents.Length;
     uploadStream.Write(fileContents, 0, contentLength);
 }

 FtpWebResponse response = (FtpWebResponse)request.GetResponse();
 Console.WriteLine(response.ExitMessage);

問題是我的 ftp 服務器上的文件沒有獲得名稱我要求其中包含英語、希臘語和德語字符 --> "δοκιμαστικ? αρχε?οü?-?Copy.txt

The problem is that file at my ftp server does not get the name I request which contains English, greek and german characters --> "δοκιμαστικ? αρχε?οü?-?Copy.txt

1) 我能用它做什么?

更改區域設置后會有一些改進 --> 非 Unicode 程序的當前語言為希臘語,但我仍然想念德語字符.

There is some improvement once I change my regional settings--> Current language for non-Unicode programs to Greek Language but I still miss the german chars.

2) 為什么 c# 程序依賴于這個設置?為了避免依賴此設置,我應該遵循一種特殊的方法嗎?

編碼噩夢再次出現:(

推薦答案

僅將字符串編碼為 UTF8 并將其作為文件名發送到 FTP 服務器是不夠的.過去所有 FTP 服務器都只理解 ASCII,而現在為了保持向后兼容性——即使它們支持 Unicode——當它們啟動時,它們也將所有文件名都視為 ASCII.

It is not enough for you just to encode your string as UTF8 and send it as filename to FTP server. In the past all FTP servers understood ASCII only and nowadays to maintain backward compatibility - even if they are Unicode aware - when they start they treat all filenemes as ASCII too.

要使這一切正常運行,您(您的程序)必須首先檢查您的服務器的功能.服務器在客戶端連接后發送其功能 - 在您的情況下,您必須檢查 FEAT UTF8.如果您的服務器發送它 - 這意味著它理解 UTF8.盡管如此 - 即使它理解它 - 你必須明確告訴它,從現在開始你將發送你的文件名 UTF8 編碼,現在它是你的程序缺少的東西(因為你的服務器支持 utf8,正如你所說的).

To make it all work you (your program) must first check what your server is capable of. Servers send their features after client connects - in your case you must check for FEAT UTF8. If your server sends that - it means it understands UTF8. Nevertheless - even if it understands it - you must tell it explicitly that from now on you will send your filenames UTF8 encoded and now it is the stuff that your program lacks (as your server supports utf8 as you've stated).

您的客戶端必須向 FTP 服務器發送以下 OPTS UTF8 ON.發送后,您可以使用 UTF8 或對您的服務器說 UTF8-ish(可以這么說).

Your client must send to FTP server the following OPTS UTF8 ON. After sending that you may use UTF8 or speak UTF8-ish (so to speak) to your sever.

閱讀此處了解詳情文件傳輸協議的國際化

這篇關于Ftp 創建帶有 utf-8 字符的文件名,例如希臘語、德語等的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應用程序密碼從 oauth2/token 獲取訪問令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 亚洲在线 | 国产99久久久国产精品下药 | 日本三级在线视频 | 日日射夜夜骑 | 亚洲一区国产精品 | 国产日韩欧美在线观看 | 中文字幕电影在线观看 | www成人免费 | 草久视频 | 日韩一区在线播放 | 免费一级毛片 | 五月天婷婷综合 | 精品国产久 | 欧美黑人一区二区三区 | 成人一区二区电影 | 又爽又黄axxx片免费观看 | 国产成人精品免费视频大全最热 | 一区二区三区国产精品 | 东京av男人的天堂 | 久久成人国产 | 国产羞羞视频在线观看 | 精品国模一区二区三区欧美 | 亚洲一区二区三区免费在线 | 欧美一级黄| 欧美精品一二三区 | 欧美精品一区二区在线观看 | 国产精品久久久久久中文字 | 天堂中文在线播放 | 欧美黑人一级爽快片淫片高清 | 日韩在线视频观看 | av黄色在线 | 国产午夜精品久久久 | 在线观看免费国产 | a精品视频| 久久久久久久久久久91 | 伊人无码高清 | 亚洲欧美日韩国产 | 亚洲国产aⅴ成人精品无吗 国产精品永久在线观看 | 99久久久久国产精品免费 | 国产精品久久久久久吹潮 | 日本在线黄色 |