Specifying Encoding While Placing Files In InDesign Using Extendscript

三世轮回 提交于 2019-12-11 12:28:05

问题


I have a script that places a Markdown file into a text frame in InDesign. Unfortunately, InDesign doesn't seem to be picking up on the UTF-8 encoding, as quotation marks and other things are ending up as “.

I tried setting file.encoding to "UTF-8" based on this question, all to no avail. Here's the relevant code as it stands:

var file = File.openDialog ("Select content markdown" , "Markdown:*.md", false );
file.encoding = "UTF-8";
myFirstTextframe.place(file);

How can I resolve this problem?


回答1:


I'm not 100% sure (perhaps InDesign is just remembering what I selected in the Import Options window), but it seems like adding this solved my problem:

with(app.textImportPreferences){
    characterSet = TextImportCharacterSet.UTF8;
    useTypographersQuotes = true;
}


来源:https://stackoverflow.com/questions/30792282/specifying-encoding-while-placing-files-in-indesign-using-extendscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!