Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 中文檔名複製到 Windows FAT32 分區亂碼終極解法

編輯:Linux 教學

問題現象

系統 Locale 為 zh_CN.gbk,將中文檔名檔案 cp 至 FAT32 分區,進 Windows 後檔名全成亂碼。

根因分析

  • Windows 使用 Unicode (UTF-16LE) 儲存檔名。
  • Linux 掛載 FAT32 時指定 iocharset=gbk,寫入時將 GBK 編碼拆成雙位元組並插入 00(如 D5FE → D500 FE00),但未正確轉為 UTF-16LE。
  • convmv 依賴 Linux 核心支援 UTF-16LE 檔名系統呼叫,但 Linux 僅內建支援 UTF-8,無法直接轉換。

實測成功方案:曲線救國

  1. 將 FAT32 分區上亂碼檔案 cp 到 Linux 原生分區(如 /root)。
  2. 再 mv 到 NTFS 分區(Linux 寫入 NTFS 會正確處理 Unicode 檔名)。
  3. 完成後進 Windows,檔名完美顯示中文。

總結

  • FAT32 不支援 Unicode,Linux 寫入機制導致 GBK 編碼錯位。
  • Linux 核心不支援 UTF-16LE 檔名系統呼叫,convmv 無法直接修正。
  • 利用 NTFS 作為中介,Linux 寫入 NTFS 可正確編碼,再由 Windows 讀取 NTFS 完美解決。
  • 過程中深入理解 GBK、UTF-8、UTF-16LE、UCS-2 編碼差異與轉換陷阱。
Copyright © Windows教程網 All Rights Reserved