replacing a special character

Discussion in 'Perl Misc' started by laredotornado@zipmail.com, Jun 14, 2007.

  1. Guest

    Hello,

    I'm running Fedora Linux Core 5. I have some weird characters in my
    files that are causing HTML validation to fail. In vim, they appear
    like

    Anderson<92>s

    where "<92>" is this odd character. It should really be an
    apostraphe. My question to the group is how do I run a perl search
    and replace command along the lines of

    perl -pi -e 's/old_expr/new_expr/g' myfile.html

    to swap out the bizarre "<92>" character with an apostraphe?

    Thanks, - Dave
     
    , Jun 14, 2007
    #1
    1. Advertising

  2. Paul Lalli Guest

    On Jun 14, 3:35 pm, ""
    <> wrote:
    > I'm running Fedora Linux Core 5. I have some weird characters in my
    > files that are causing HTML validation to fail. In vim, they appear
    > like
    >
    > Anderson<92>s
    >
    > where "<92>" is this odd character. It should really be an
    > apostraphe. My question to the group is how do I run a perl search
    > and replace command along the lines of
    >
    > perl -pi -e 's/old_expr/new_expr/g' myfile.html
    >
    > to swap out the bizarre "<92>" character with an apostraphe?


    Sounds like you have a "smart quote" in there. Hex 92 is Decimal 146,
    which is the ' character in whatever character set I'm using....

    I would try:
    perl -pi -e"s/\x22/'/g" myfile.html

    Paul Lalli
     
    Paul Lalli, Jun 14, 2007
    #2
    1. Advertising

  3. On 2007-06-14 20:00, Paul Lalli <> wrote:
    > On Jun 14, 3:35 pm, ""
    ><> wrote:
    >> I'm running Fedora Linux Core 5. I have some weird characters in my
    >> files that are causing HTML validation to fail. In vim, they appear
    >> like
    >>
    >> Anderson<92>s
    >>
    >> where "<92>" is this odd character. It should really be an
    >> apostraphe. My question to the group is how do I run a perl search
    >> and replace command along the lines of
    >>
    >> perl -pi -e 's/old_expr/new_expr/g' myfile.html
    >>
    >> to swap out the bizarre "<92>" character with an apostraphe?

    >
    > Sounds like you have a "smart quote" in there. Hex 92 is Decimal 146,
    > which is the ' character in whatever character set I'm using....
    >
    > I would try:
    > perl -pi -e"s/\x22/'/g" myfile.html


    ITYM:

    perl -pi -e"s/\x92/'/g" myfile.html

    hp


    --
    _ | Peter J. Holzer | I know I'd be respectful of a pirate
    |_|_) | Sysadmin WSR | with an emu on his shoulder.
    | | | |
    __/ | http://www.hjp.at/ | -- Sam in "Freefall"
     
    Peter J. Holzer, Jun 17, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tor Inge Rislaa

    Replacing character with ASCII code (HTML)

    Tor Inge Rislaa, Nov 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    367
    Tor Inge Rislaa
    Nov 13, 2006
  2. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    299
    Chris Hohmann
    Apr 11, 2005
  3. Une Bévue
    Replies:
    9
    Views:
    189
    Une Bévue
    Sep 26, 2007
  4. Amanda ..

    replacing a character in a string

    Amanda .., Jun 10, 2008, in forum: Ruby
    Replies:
    7
    Views:
    108
    Amanda ..
    Jun 10, 2008
  5. Mike
    Replies:
    3
    Views:
    130
    Michele Dondi
    Feb 19, 2004
Loading...

Share This Page