Ron Rushing
Ron Rushing

Reputation: 1

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

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

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

I am using TCL

Upvotes: 0

Views: 265

Answers (1)

Brad Lanam
Brad Lanam

Reputation: 5723

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.

Upvotes: 1

Related Questions