
命令行工具exiftool寫入中文標題的測試最后由 czjt1234 于 -5-10 09:37https://exiftool.orghttps://exiftool.org/exiftool-12.83.zip在其命令行幫助中
可以看到不支持GBK和GB2312所以 http://www.bathome.net/viewthread.php?tid=2765 中提到的exiftool.exe -charset GB2312 -XPComment=測試 dst.jpg就不可行了在此帖18樓有個腳本,需要另存為 utf-8 編碼nclick="copycode($('code0'));">復制代碼
- -charset [[*TYPE*=]*CHARSET*]
- If *TYPE* is ExifTool or not specified, this option sets the
- ExifTool character encoding for output tag values when reading and
- input values when writing, with a default of UTF8. If no
- *CHARSET* is given, a list of available character sets is returned.
- Valid *CHARSET* values are:
- CHARSET Alias(es)Description
- -----------------------------------------------------------
- UTF8cp65001, UTF-8 UTF-8 characters (default)
- Latin cp1252, Latin1 Windows Latin1 (West European)
- Latin2cp1250 Windows Latin2 (Central European)
- Cyrilliccp1251, RussianWindows Cyrillic
- Greek cp1253 Windows Greek
- Turkish cp1254 Windows Turkish
- Hebrewcp1255 Windows Hebrew
- Arabiccp1256 Windows Arabic
- Balticcp1257 Windows Baltic
- Vietnam cp1258 Windows Vietnamese
- Thaicp874Windows Thai
- DOSLatinUScp437DOS Latin US
- DOSLatin1 cp850DOS Latin1
- DOSCyrillic cp866DOS Cyrillic
- MacRomancp10000, Roman Macintosh Roman
- MacLatin2 cp10029Macintosh Latin2 (Central Europe)
- MacCyrillic cp10007Macintosh Cyrillic
- MacGreekcp10006Macintosh Greek
- MacTurkishcp10081Macintosh Turkish
- MacRomanian cp10010Macintosh Romanian
- MacIcelandcp10079Macintosh Icelandic
- MacCroatian cp10082Macintosh Croatian
測試可行但是,由于UTF8編碼的特殊性,它本身存在一二三四五六字節的編碼所以特殊環境下可能會出現相鄰的字節被錯誤組合的情況,也就是http://www.bathome.net/thread-68945-1-2.html這里提到的rem語句異常的現象所以把該批處理中的 測試 改成 測1試 或 QQ瀏覽器都會不能正確寫入中文在 https://exiftool.org/exiftool_pod.html#READING-EXAMPLES 中有個示例代碼exiftool -xmp:description-de='k& uuml;hl' -E dst.jpg使用HTML轉義符寫入特殊字符瀏覽器這三個字對應的HTML轉義符是 & #27983;& #35272;& #22120;exiftool -Title=& #27983;& #35272;& #22120; -E dst.jpg注意復制測試時,把&后面的空格去掉,即把& #改為&#測試成功附一個把漢字轉換為HTML轉義符的 HTML.vbsnclick="copycode($('code1'));">復制代碼
- : & chcp 65001 & cls
- @echo off
- exiftool.exe -charset UTF8 -XPComment=測試 dst.jpg
- pause
可以在for語句中調用,示例:cscript.exe /nologo HTML.vbs QQ瀏覽器當這個辦法比較啰嗦,不知道有沒有別的辦法可以直接完成nclick="copycode($('code2'));">復制代碼
- Dim s, n, i, m
- If wsh.Arguments.Count = 0 Then wsh.Quit()
- s = wsh.Arguments(0)
- n =
- For i = 1 To Len(s)
- m = CLng(&H & Hex(AscW(Mid(s, i, 1))))
- If m > 127 Then
- n = n & &# & m & ;
- Else
- n = n & Mid(s, i, 1)
- End If
- Next
- wsh.Echo n

