In This Article:

    "SyntaxError: unterminated string literal" -- the attack of Unicode

    In This Article:

      Background

      Did you just get an error on a public-facing page that says Syntax: unterminated string literal

      Did Salsa tell you that your email blast has "Unicode" in it, but you can't find it (or don't even know what it means)?

      Read on to lean how to find the unicode in your page/blast and get rid of it.

      Audience

      • Campaign managers that create public pages
      • Developers that read and write user supportered data
      • Salsa support specialists

      What is happening

      Sometimes editors on computers will put in special characters that make the text look beautiful. Text editors insert curly quotes and apostrophes or en- (short) and em- (long) dashes so that the text looks nice. If you are one of those folks that has been advised to copy your Word document to a text editor, the text editor can miss invisible characters when the Word document is pasted in. (This happens a lot on Macs.)

      All of these pretty and invisible characters are in a character type known as Unicode. Each letter is represented by multiple bytes of data. If you'd like to learn more, then this Wikipedia article will be very helpful for you.

      What needs to be done

      Those unicode characters must be removed. Salsa's products has a problem converting them to usable text when a public page is displayed or an email blast is sent. While Salsa works on getting that problem solved, you'll need to remove the Unicode characters manually.

      The "curlies" and fancy dashes are fairly easy to fix. If you see them when you are editing a Salsa page, then backspace over them and use your keyboard to replace them. On the other hand, the invisible characters are harder because, well, invisible.

      You will need

      1. The Salsa page that contains the unicode character(s)
      2. A text editor like TextEdit, TextWrangler or NotePad. Do not use Microsoft Word!
      3. A web browser

      Details

      The process for finding and removing all unicode characters uses an external website that converts your text into a standard format mostly used by email programs like Outlook. When the output is displayed, unicode characters stand out like a sore thumb, and are easy to find and remove -- even if they are invisible. Here we go!

      Step 1: Copy the HTML for the page

      • Edit the page that contains the unicode characters.
      • View the HTML for the content of the page. If you are using Salsa's WYSIWYG editor, then the HTML can be viewed by clicking on the Source button.
      • Copy the HTML. Do not copy anything but HTML because that won't work.

      Step 2: Find the unicode characters

      • Click this link: http://www.webatic.com/run/convert/qp.php
      • (NOTE: The link above has replaced a previous tool that no longer exists.  The details below are for the old tool and need to be rewritten based on the new tool's layout.  The approach is essentially the same though.  Convert the text from the top box, to the lower box, and then remove any of the '=XX' codes.)
      • When the page open, click on the Direct Input link.
      • Paste the text into the box that pops up.
      • Click on the QP-encode button.
      • When the next page appears, your original text will be in the box on top, and the processed text will be in the box on the bottom.
      • You will see unicode characters as 9 characters with equal signs in them. The first character is =E2, which is the marker character for a Unicode character.
      • You will also see
        • = at the end of the line.  This is normal, do not remove these.
        • =0A This is a return character.  Not unicode, do not remove these.
        • =3D This is an equal sign.  Not unicode, do not remove these.
      • You may also see a big error block at the bottom of the page. Move along. This is not the block you are looking for.

      Step 3: Remove the unicode characters

      • Copy the contents of the bottom box.
      • Paste the contents into a text editor like TextEdit or TextWrangler or NotePad.  Do not use Microsoft Word!
      • Find anything that looks like "=E2=NN=NN", where "N" is a number or A through F.  For example: =E2=80=A8
      • Remove all 9 characters.
      • Continue searching and removing until all of the unicode characters are gone.
      • Copy the contents from your text editor.

      Step 4: Convert the text back to HTML

      • Click on this link again: http://i-tools.org/quotedprintable
      • Click on the Direct Input link again.
      • Paste the contents into the box that appears (you may have to clear it out first).
      • This time, click the QP-Decode button.
      • When the page appears, the unicode characters have been removed and the HTML has been restored. Yay!
      • Copy the contents of the bottom box.

      Step 5: Insert the HTML

      • Go back to the page that you were editing.
      • If you are using the WYSIWYG editor, then make sure that the Source button has been clicked and that you can see HTML.
      • Remove the current contents.
      • Paste in the HTML from the website.
      • Save the page.
      • Test, test, test!

      Summary

      If you get the dreaded "Syntax: unterminated string literal" message on your public page, or if Salsa advises you that you have Unicode in your page or email, now you have a way to remove the Unicode and make your page/blast work.

       

      Was this article helpful?
      0 out of 0 found this helpful
      Have more questions? Submit a request

      Comments

      0 comments

      Article is closed for comments.