Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:47:24+00:00 2026-06-03T08:47:24+00:00

htmlspecialchars() appears to be translating special chars like the following: āķūņūķī into their respective

  • 0

htmlspecialchars() appears to be translating special chars like the following:
āķūņūķī into their respective entity number:

ā ķ ū ņ ū ķ ī

While some remain untranslated such as:

žš

I would like htmlspecialchars() (or some other function) to not translate these alphabetical type of characters… So that it only translates the following (as it seems to indicate on the php.net manual):

  1. ‘&‘ (ampersand) becomes ‘&’
  2. ‘“‘ (double quote) becomes ‘"’ when ENT_NOQUOTES is not set.
  3. “‘” (single quote) becomes ‘'’ only when ENT_QUOTES is set.
  4. ‘<‘ (less than) becomes ‘&lt;’
  5. ‘>‘ (greater than) becomes ‘&gt;’

The reason why I need this is because after a POST request, i am running this user input through htmlspecialchars() before placing it back into a new set of html inputs. Characters such as &,”,’,<,>, need to be translated so to not cause display errors etc. But i need the special chars such as ‘āķūņūķī‘ remain unchanged. Else the user will be very confused.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:47:26+00:00Added an answer on June 3, 2026 at 8:47 am

    Set the third parameter as UTF-8:

    echo htmlentities('āķūņūķī', ENT_QUOTES, 'UTF-8');
    

    The default encoding for htmlspecialchars is ISO-8859-1.

    Test case:

    var_dump(htmlentities('āķūņūķī'));
    var_dump(htmlentities('āķūņūķī', ENT_QUOTES, 'UTF-8'));
    

    Output:

    string(84) "&Auml;�&Auml;&middot;&Aring;&laquo;&Aring;�&Aring;&laquo;&Auml;&middot;&Auml;&laquo;"
    string(14) "āķūņūķī"
    

    http://codepad.org/MCaDosQ5

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does Java have standard functions for security like in php htmlspecialchars , strip_tags ?
I am using php. I have a problem with special chars. I have a
<?php $new = htmlspecialchars(<a href='test'>Test</a>, ENT_QUOTES); echo $new; ?> output should be & lt;a
i used htmlspecialchars to clean site comments, it's change <> to html special character.
To avoid SQL injection and XSS we use the function htmlspecialchars() or others like
I have an array of values that I would like to run through htmlspecialchars
I have a strange problem: htmlspecialchars(with ENT_QUOTES) and mysql_real_escape_string functions aren't translating single quote
I have the following line of code this.htmlSpecialChars = this.getSpecialCharMap(); where private HashMap<String,String> htmlSpecialChars;
htmlspecialchars won't do it and neither does htmlentities .
Do i use htmlspecialchars on $_GET['search'] on page2? Wouldn't i have to remove the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.