How do I convert MS Smart quotes “ into ascii? using Tool command language (TCL)

191 views Asked by At

I used the following but it does not recognize the smart quotes

set EmailSubject [string map -nocase {“ \\u0093  } $EmailSubject]

I am using TCL

1

There are 1 answers

3
Brad Lanam On

There are several issues here.

  • What is \u0093 doing there? That's a control character.
  • \u.... will not be converted when inside braces.
  • -nocase is not needed, alpha characters are not being converted.
  • I recommend using the \u.... format rather than embedding the characters.

I am also going to make an assumption that by "converting into ascii", you want the ordinary " character. If this is wrong, please update your question.

The characters to convert are \u201C and \u201D, the left and right curly quotation marks. So the string map command will look like:

set EmailSubject [string map [list \u201C \" \u201D \"] $EmailSubject]

This converts both \u201C and \u201D into the " character.