在使用Extendscript在InDesign中放置文件时指定编码 [英] Specifying Encoding While Placing Files In InDesign Using Extendscript

查看:216
本文介绍了在使用Extendscript在InDesign中放置文件时指定编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本将Markdown文件放入InDesign的文本框架中。不幸的是,InDesign似乎没有采用UTF-8编码,因为引号和其他事情最终以,Äú

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 “.

我尝试将 file.encoding 设置为UTF-8 a href =http://stackoverflow.com/questions/29272770/getting-st-characters-when-pasting-from-the-clipboard-into-indesign>这个问题,都没有用。以下是相关代码:

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);

如何解决此问题?

推荐答案

我不是100%肯定(也许InDesign只是记住我在导入选项窗口中选择),但似乎添加这个解决了我的问题:

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;
}

这篇关于在使用Extendscript在InDesign中放置文件时指定编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆