Article View: adobe.scripting.indesign
Article #9544write/writeln fails for some strings
From: thechrisproject
Date: Thu, 17 Aug 2006 14:18
Date: Thu, 17 Aug 2006 14:18
21 lines
4573 bytes
4573 bytes
I have a string which is a giant chunk of xml that represents the contents of an .inx file. I need to make a new file and write this string to it. My first guess was to just make a new file, and use a single write statement, like this:
var newFile = File("~/Documents/newFile.inx");
newFile.open("w");
newFile.write(xmlText);
newFile.close();
This fails. The write command returns false. I then tried doing it line by line:
var newFile = File("~/Documents/newFile.inx");
newFile.open("w");
var xmlLines = xmlText.split('\n');
for(var i = 0; i < xmlLines.length; i++) { success = newFile.write(xmlLines[i]); if(!success) $.writeln('failed to write line: ' + xmlLines[i]); } newInxFile.close();
Out of the hundreds of lines, only five fail. It is always the same five. Here's the output:
failed to write line: <cfen pnam="k_Kana" font="c_Kozuka Mincho Pro" ptfs="k_R" jcfs="D_100" bshf="D_0" phzs="D_100" pvts="D_100" jcfc="k_ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔゕゖゝゞァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺーヽヾ" plck="b_t" jcfa="b_t" ptag="x_0" Self="rc_u77"/>
failed to write line: <cfen pnam="k_Punctuation" font="c_Kozuka Mincho Pro" ptfs="k_R" jcfs="D_100" bshf="D_0" phzs="D_100" pvts="D_100" jcfc="k_�―‖����‥�′″∥、。〈〉《》「」『』【】〔〕〜・!(),./:;?[]{}~" plck="b_t" jcfa="b_t" ptag="x_0" Self="rc_u78"/>
failed to write line: <cfen pnam="k_Symbols" font="c_Kozuka Mincho Pro" ptfs="k_R" jcfs="D_100" bshf="D_0" phzs="D_100" pvts="D_100" jcfc="k_�����������ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё‐���※℃Å←↑→↓⇒⇔∀∂∃∇∈∋−√∝∞
Technical Details
Message-ID:
<3bc14b95.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,79c571a773294c0e,start X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII From: thechrisproject@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: write/writeln fails for some strings Message-ID: <3bc14b95.-1@webcrossing.la2eafNXanI> Date: Thu, 17 Aug 2006 07:18:26 -0700 Lines: 73 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing