How can I replace smart quotes in Text that is inputted via keyboard?

0 favourites
  • 3 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • I am brand new to construct so I might be overlooking something, but I am particularly stumped on this issue.

    In my spelling game the user can enter input via the keyboard with contractions like "don't." I have a need in my game to support both straight apostrophes "'" and smart apostrophes "’" as input, but I'd like the smart apostrophes to be converted to straight apostrophes "'" so that my text comparisons still work.

    For Set text action I have:

    replace(spellingTextBox.Text, "’", "'")

    The problem is the smart quote is not getting recognized for comparison and is instead getting converted to "’". I think the construct editor is not recognizing that it is a UTF-8 character.

    How can I properly replace the smart quote with a straight quote?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It works fine for me:

  • It works fine for me:

    I appreciate your response, could it be with my version of construct perhaps? In any case, I did have luck with this instead

    trim(RegexReplace(spellingTextBox.Text, "\u2019", "g", "'"))

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)