SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    934
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Special Characters in input fields

    I am experiencing a problem where data loaded into input fields are being changed from special characters to actual characters which causes problems when submitted.

    In other words, instead of: ñ
    this character is displayed and submitted:

    The end result is question marks in the output.

    What is the best way to manage this?

    Michael

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    You'll need to htmlentity it:

    PHP Code:
    echo '<input type="text" name="myText" value="' htmlentities('&ntilde;') . '" />'
    This will output something like:

    PHP Code:
    <input type="text" name="myText" value="&amp;ntilde;" /> 
    Which will show an input in your HTML page containing: &ntilde;

  3. #3
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    934
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Brilliant! duh..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •