• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

importXML failed when incoming xml having special characters like 'ü', é.

Contributor ,
May 10, 2023 May 10, 2023

Copy link to clipboard

Copied

Hi All,

 

We are using InDesignServer CC 2023

In our xml based workflow we are generating actual document after importing an xml.

The issue came up when our incoming xml contents has special character like  'ü', é in it.

e.g

abc.xml has following contents

=====

href="file://%2fVolumes%2ftest%2fimages%2f1000_2000%2f1155_656_%c3%bcsmsung_Galaxy_something.jpg"

here üsmsung_Galaxy_something.jpg = %c3%bcsmsung_Galaxy_something.jpg

=====

an exception gets thrown when we call

objDoc.importXML(abc.xml)

 

Can anyone suggest how I could fix the issue.

Regards,

Alam

TOPICS
Import and export , Scripting

Views

634

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , May 11, 2023 May 11, 2023

Thanks to all for their valueable reply

We found following when checking file system further

There seems another issue with special character(s) like ü in combination with usage of NFS-volumes.

As Indesign is installed on OSX, it seems OSX uses slightly different encoding type ‘NFD’. Now when files are uploaded via safari, they seem to have ‘NFC’ encoding. (difference is that f.i. ü in NFC this complete character is encoded, while NFD is adding u + encoded ¨).

it is notice that when uploading files

...

Votes

Translate

Translate
Community Expert ,
May 10, 2023 May 10, 2023

Copy link to clipboard

Copied

Are you sure it's the problem with the XML contents? Your special characters are converted to ASCII "representation" so it's rather problem with access to the file itself on your drive / network - what exactly is the error you are getting?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2023 May 10, 2023

Copy link to clipboard

Copied

Hi Robert,

you may be right the problem is with access to file as on network drive we have file at location

/Volumes/test/test2/images/1000_2000/1128_639_üser.png

and its entry in xml file look like

href="file://%2fVolumes%2ftest%2ftest2%2fimages%2f1000_2000%2f1128_639_%c3%bcser.png

 

but when we do objDoc.importXML(abc.xml) then we are getting exception with message

ReferenceError: User canceled this action

 

Regards,

Alam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2023 May 10, 2023

Copy link to clipboard

Copied

Are you on PC or Mac? 

 

On PC paths have "\" not "/".

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2023 May 10, 2023

Copy link to clipboard

Copied

Ok, looks like "/" is OK afterall - but you have 3x of them - "//%2f" - maybe that's the problem?

 

And you can always try and copy full path to your browser and see if it works. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

You can use decodeURI() to get the slashes right:

 

href = "file://" + decodeURI('%2fVolumes%2ftest%2fimages%2f1000_2000%2f1155_656_%c3%bcsmsung_Galaxy_something.jpg') + '"';

depending how you obtain the file name. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 11, 2023 May 11, 2023

Copy link to clipboard

Copied

Thanks to all for their valueable reply

We found following when checking file system further

There seems another issue with special character(s) like ü in combination with usage of NFS-volumes.

As Indesign is installed on OSX, it seems OSX uses slightly different encoding type ‘NFD’. Now when files are uploaded via safari, they seem to have ‘NFC’ encoding. (difference is that f.i. ü in NFC this complete character is encoded, while NFD is adding u + encoded ¨).

it is notice that when uploading files with safari-browser on mac, files have NFC, other browsers on mac use NFD encoding. Probably all windows browsers use NFC.

https://stackoverflow.com/questions/63791942/prevent-safari-from-normalizing-unicode-when-sending-po... 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 12, 2023 May 12, 2023

Copy link to clipboard

Copied

LATEST

That's why ONLY ASCII characters should be used in the file paths and naming of the files.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines