title: VBScript function is taking out foreign characters
body: <p>I have an old function in VBScript for Classic ASP that strips out illegal characters when a form is submitted, but it's also stripping out foreign characters and replacing them with junk like A*@L, etc.</p>
  
  <p>The function looks like this:</p>
  
  <pre><code>Private Function stripillegal(fieldcontents)
      if isnull(fieldcontents) then
          stripillegal = ""
      else
          Dim stripped, stripillegal_c, stripillegal_i
          stripped = ""
  
          if isempty(fieldcontents) then fieldcontents = ""
  
          fieldcontents = CStr( fieldcontents )
          fieldcontents = Trim( fieldcontents )
  
          if Len(fieldcontents)&gt;0 then
              for stripillegal_i = 1 to Len(fieldcontents)
                  stripillegal_c = asc(mid(fieldcontents, stripillegal_i, 1))
  
                  select case stripillegal_c
                  case 39
                      stripped = stripped &amp; "&amp;#39;"
                  case 37
                      stripped = stripped &amp; "&amp;#37;"
                  case 34 ' quote (34)
                      stripped = stripped &amp; "&amp;#34;"
                  case else
                      stripped = stripped &amp; chr(stripillegal_c)
                  end select
                  ' response.write stripped &amp; "&lt;br&gt;"
              next
          end if
  
          stripped = trim(stripped)
          while Right(stripped, 1) = chr(13) OR Right(stripped, 1) = chr(10)
              stripped = left(stripped, len(stripped)-1)
          wend
  
          stripillegal = stripped
      end if
  End Function
  </code></pre>
  
  <p>I'm wondering how to tell it to allow foreign characters like those found in French or Spanish.</p>