Skip to main content
Inspiring
May 10, 2023
Answered

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

  • May 10, 2023
  • 2 replies
  • 1416 views

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

This topic has been closed for replies.
Correct answer alam_84

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-post-data 

2 replies

Peter Kahrel
Community Expert
Community Expert
May 11, 2023

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. 

alam_84AuthorCorrect answer
Inspiring
May 12, 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 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-post-data 

Robert at ID-Tasker
Legend
May 12, 2023

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

 

Robert at ID-Tasker
Legend
May 10, 2023

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?

 

alam_84Author
Inspiring
May 10, 2023

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

Robert at ID-Tasker
Legend
May 10, 2023

Are you on PC or Mac? 

 

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