跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 跨平台文件名乱码问题

发表于

我用一台 win10 共享盘作为电影存储。 用 OpenWRT 跑下载软件,下载电影到共享盘上。

发现下载的电影,如果文件名(或者文件夹名)含中文,在 OpenWRT 中看是中文,在 win10 中看就成了乱码。 比如在 OpenWRT 中文件名是“c 租 c 司 j.1976.BD1080p.HDR.中文字幕”。 到了 win10 中就成了“c租c司j.1976.BD1080p.HDR.中文字幕”

网上早了很久,发现问题是 OpenWRT 的文件名是 utf8 编码的,但是 win10 用 iso8859-1 编码。 我用 python 写一段代码:

text = b"c租c司j.1976.BD1080p.HDR.中文字幕"

bytes_text = text.decode("UTF-8")
string = bytes_text.encode("ISO8859-1")

print(string)

可以成功消除乱码。

但是问题是,我并不想写个脚本随时运行去修改电影的名字(如何触发,如何避免修改到非 utf8 的文件名等都是问题)。 讲道理更合理的办法是让 win10 支持正确显示 utf8 的文件名,但是似乎在微软的网站没有找到合适的方法(说的是在区域的高级设置中勾选 unicode 支持的 beta 功能选项,然而并无卵用。

不知道各位有什么高招没有?

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.