Skip to main content
Known Participant
May 10, 2017
Question

Keep text "\"

  • May 10, 2017
  • 5 replies
  • 446 views

I want to keep the "\" in the static text below but the output shows it missing.  How can I maintain the "\" in the static text?

{

                                    type: "view",

                                    align_children: "align_top",

                                    alignment: "align_top",

                                    elements:

                                    [

                                        {

                                            type: "static_text",

                                            name: "      *Note: Retrieve labeled files from c:\Automatically Labeled Documents folder.",

                                           

                                        },

                                    ]

                                  },

This topic has been closed for replies.

5 replies

JR Boulay
Community Expert
Community Expert
May 11, 2017

In French (as in Spanish, Italian, German, etc.), we are used to handling accented and special characters in JavaScript strings.

This JavaScript:

app.alert("\u0044\u00E8\u0073\u0020\u004E\u006F\u00EB\u006C\u0020\u006F\u00F9\u0020\u0075\u006E\u0020\u007A\u00E9\u0070\u0068\u0079\u0072\u0020\u0068\u0061\u00EF\u0020\u006D\u0065\u0020\u0076\u00EA\u0074\u0020\u0064\u0065\u0020\u0067\u006C\u0061\u00E7\u006F\u006E\u0073\u0020\u0077\u00FC\u0072\u006D\u0069\u0065\u006E\u0073\u0020\u006A\u0065\u0020\u0064\u00EE\u006E\u0065\u0020\u0064\u0027\u0065\u0078\u0071\u0075\u0069\u0073\u0020\u0072\u00F4\u0074\u0069\u0073\u0020\u0064\u0065\u0020\u0062\u0153\u0075\u0066\u0020\u0061\u0075\u0020\u006B\u0069\u0072\u0020\u00E0\u0020\u006C\u0027\u0061\u00FF\u0020\u0064\u0027\u00E2\u0067\u0065\u0020\u006D\u00FB\u0072\u0020\u0026\u0020\u0063\u00E6\u0074\u0065\u0072\u0061\u0020\u0021");

Displays this alert:

(Do not look for any meaning in this sentence it is a pangram.)

.

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
May 11, 2017

Hi.

Using 2 backslashes is the old school practice and it's not reliable.

You should use the Unicode ID of the backslash instead, as for the ":", for the "*" and for any special character.

The last line of the script should look like this:

name: "\u002ANote\u003A Retrieve labeled files from c\u003A\u002FAutomatically Labeled Documents folder.",

You can download this free tool to convert any character to its Unicode ID: http://abracadabrapdf.net/download/Texte2Unicode.pdf

Enter your text in the first text field, clic anywhere else and voilà!

Acrobate du PDF, InDesigner et Photoshopographe
suemo22Author
Known Participant
May 10, 2017

Yay! Thx.

try67
Community Expert
Community Expert
May 10, 2017

Add a "\" before it.

Bernd Alheit
Community Expert
Community Expert
May 10, 2017

Use 2 backslashes \\