Replance non ASCII character

  • Sorry, I asked this a while ago and someone suggested using the REPLACE function - but I can't get it to work.

    How can I replace a non ASCII character - a single closing typographer's quotation mark - with an ASCII inverted comma?

    Say I have an email address like FredO'Shea@fred.cam

    The apostrophe in that email address is a typographer's quote that was put in there by typing Alt 0146 - it is not an ASCII character

    If that email address is set to a variable called @EmailAddress and I try to Replace it using

    REPLACE(@EmailAddress, ''', ''') - it doesn't work.

    Sorry, it is hard to show here - in the REPLACE function above it should contain, from the left ...

    The variable @EmailAddress,

    An inverted comma, a typographer's single closing quotation mark, an inverted comma,

    An inverted comma, an inverted comma, an inverted comma,

    I have tried doubling up on the single quotes - but I can't get it to replace the typographer's quotation mark with a ASCII single inverted comma.

    (The reason for this is that an Exchange Mail Server rejects an email address with a typographer's quote in it).

    Ahhh, apologies, I just replied to an earlier post on this subject - I didn't realise the reply would move the question back up to the top of the list of topics - I thought it might be lost much further down the list.

  • I'm not 100% sure I understand your requirement, but does this point you in the right direction?

    REPLACE(@EmailAddress, CHAR(146), '''')

    John

  • That does it exactly. Thank you very much.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply