JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java IDE » Eclipse  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 包裝成JAR後的編碼問題
arvinwang





發文: 11
積分: 0
於 2010-03-23 18:55 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最近用JAVA 實作FTP SERVER,用eclipse測試執行,本來用fileZilla傳中文檔的時候,檔名會變亂碼,後來把程式的編碼改用UFT-8,測試就正常了,但匯出成JAR後,傳中文檔又變成亂碼,請問這個問題要如何解??

Eclipse版本:3.4.2
FileZilla編碼:UTF-8

附上處理上傳程式碼:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
String fileName = request.getArgument();
fileName = mUser.getVirtualDirectory().getAbsoluteName(fileName);
String physicalName = mUser.getVirtualDirectory().getPhysicalName(fileName);
File requestedFile = new File(physicalName);
 
Socket dataSoc = mDataConnection.getDataSocket();
 
is = dataSoc.getInputStream();
 
RandomAccessFile raf = new RandomAccessFile(requestedFile, "rw");
raf.setLength(skipLen);
raf.seek(skipLen);
os = mUser.getOutputStream( new FileOutputStream(raf.getFD()) );
 
StreamConnector msc = new StreamConnector(is, os);


reply to postreply to post
作者 Re:包裝成JAR後的編碼問題 [Re:arvinwang]
arvinwang





發文: 11
積分: 0
於 2010-03-24 10:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
已經找到解決的方法了,只要在設定裡面加入參數 -Dfile.encoding=UTF-8,設定java使用的編碼,就正常了

參考網址:http://www.wretch.cc/blog/pon24/13729920


reply to postreply to post
» JWorld@TW »  Java IDE » Eclipse

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8