Filtering Odd Ascii Characters from MYSQL Input

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zzapper

    Filtering Odd Ascii Characters from MYSQL Input

    Hi,
    My users are sometimes pasting "funny" quotation marks into their FCKEditor, also some kind of
    elongated hypen. How can I filter these out before writing the user input to mySQL?
    Obviously I could filer each one out, but I rather like something more generic.




    --
    zzapper (vim, cygwin, wiki & zsh)
    vim -c ":%s%s*%Cyrnfr) fcbafbe[Oenz(Zbbyranne% |:%s)[[()])-)Ig|norm Vg?"
    http://www.rayninfo.co.uk/tips/ vim, zsh & life tips
  • zzapper

    #2
    Re: Filtering Odd Ascii Characters from MYSQL Input

    On Tue, 04 Jan 2005 21:46:07 +0000, wrote:
    [color=blue]
    >Hi,
    >My users are sometimes pasting "funny" quotation marks into their FCKEditor, also some kind of
    >elongated hypen. How can I filter these out before writing the user input to mySQL?
    >Obviously I could filer each one out, but I rather like something more generic.[/color]

    I've found

    UPDATE table_name SET field_name1=rep lace(replace(fi eld_name1, '>', ''), '<', '')

    But what I'm really after is probably some kind of hex filter eg 0x80-0xff etc


    --
    zzapper (vim, cygwin, wiki & zsh)
    vim -c ":%s%s*%Cyrnfr) fcbafbe[Oenz(Zbbyranne% |:%s)[[()])-)Ig|norm Vg?"
    http://www.rayninfo.co.uk/tips/ vim, zsh & life tips

    Comment

    • zzapper

      #3
      Re: Filtering Odd Ascii Characters from MYSQL Input

      On Tue, 04 Jan 2005 21:46:07 +0000, wrote:
      [color=blue]
      >Hi,
      >My users are sometimes pasting "funny" quotation marks into their FCKEditor, also some kind of
      >elongated hypen. How can I filter these out before writing the user input to mySQL?
      >Obviously I could filer each one out, but I rather like something more generic.[/color]

      Found this is easily done by my script eg

      PHP

      $patterns = array ("/“/","/”/","/–/");
      $replace = array (chr(39),chr(39 ),chr(45));
      $text = preg_replace($p atterns, $replace, $document);



      --
      zzapper (vim, cygwin, wiki & zsh)
      vim -c ":%s%s*%Cyrnfr) fcbafbe[Oenz(Zbbyranne% |:%s)[[()])-)Ig|norm Vg?"
      http://www.rayninfo.co.uk/tips/ vim, zsh & life tips

      Comment

      Working...