I cannot understand why (some iOS/iCloud/Shortcuts update), since 2024 April 4 DEVONSave v3 shortcut is creating html files in UTF-16LE.
These render fine on DTTG but they are not rendered properly on DT.
Is there a way from within DT to script re-open the files as UTF-16LE and save them back as default encoding?
(reason why I use DEVONSave v3 over the extension/bookmarklet: it really saves the text as displayed on screen, including Safari Translated articles)
I have the same issue with ALL files. Changing to content=“text/html; charset=utf-16” does not solves the issue in DT, it still interprets as UTF-8.
Apart of adding two <�/html> tags at the ending, that I’ve corrected in my Shortcut Script, an Hex view shows some weird start characters:
My sample marked as UTF-8, attached, shows perfect in Safari and Edge macOS, but wrong in DT. Trying to edit something in DT, completely corrupts the file. BBEdit shows well in text mode, but changing into UTF-16 from BBEdit, shows nothing in DT but still is viewed right in Safari and Edge.
Perhaps could be interesting a menu entry to change the encoding as Web Navigators have.
I’m trying to sort this issue with a smart rule, but I cannot make it work. My idea is convert the received file to utf-8 from utf-16. From terminal the conversion works and I get a new utf-8 file that works inside DT. However, when I try to do it via one Smart Rule, the resulting file ends orphaned.
I think I need to “get” the resulting file and add to the same folder as the original, and delete the original, but I don’t know how to do it. Any help is appreciated.
Tried this in the script, but now apart of the orphaned files, it logs “skipped” on each file.
I’m an absolute negate to this kind of things. What I want to accomplish, is convert the same file from UTF-16 to UTF-8, and then continue with the DT part of DEVONsave script.
on performSmartRule(theRecords)
repeat with theRecord in theRecords
set thePath to path of theRecord
set newPath to (texts 1 thru -5 of thePath) & "_UTF-8.html"
do shell script "iconv -f utf-16 -t utf-8 " & quoted form of thePath & " > " & quoted form of newPath
delay 1
set theGroup to incoming group -- esto apunta a la bandeja de entrada global
import newPath to theGroup
end repeat
end performSmartRule
on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
set source of theRecord to (do shell script "iconv -f UTF-16LE -t UTF-8 " & (quoted form of (path of theRecord as string)))
set tags of theRecord to ((tags of theRecord) & "UTF-8")
end repeat
end tell
end performSmartRule
This will be useful until next update should solve the issue.