久久久久久久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 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 欧美精品一区二区免费 | 日本a视频| 国产69久久精品成人看动漫 | 蜜臀久久99精品久久久久野外 | 日日干夜夜操天天操 | 国产精品精品视频一区二区三区 | 国产亚洲精品美女久久久久久久久久 | 久久久久久综合 | 91中文在线观看 | 国产精品一区二区不卡 | 在线91| 精品美女久久久 | 久久久91 | 91视频18| 亚洲精品v日韩精品 | 日韩欧美网 | 中文字幕乱码亚洲精品一区 | 久久久精品网站 | 欧美一区二区三区视频 | 久久久久久久综合 | 亚洲第一中文字幕 | www.成人在线视频 | 91久久国产综合久久 | 精品国产欧美一区二区 | 日韩精品在线看 | 欧美在线观看一区 | 久久久久国产一区二区三区四区 | 成人性视频免费网站 | 成人精品国产一区二区4080 | 国产亚洲欧美在线视频 | 在线日韩福利 | 国产一区二区三区免费 | 美国一级黄色片 | 日本黄色免费片 | 人人干人人看 | 国产精品久久影院 | 99热国产在线播放 | 色婷婷亚洲一区二区三区 | 欧美亚洲视频 | 干出白浆视频 | 欧美精品一区二区在线观看 |