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 7830889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:27:10+00:00 2026-06-02T11:27:10+00:00

It seems I have another problem with special character and double quotes and so

  • 0

It seems I have another problem with special character and double quotes and so on after this question that has been solved earlier.

I used to use this function that convert symbol like ‘&’ to numberic code for XML,

function convert_specialchars_to_xmlenties($string) 
{ 

    # in order to convert  <, >, &, ' and ", include them into the square brackes [<\'"&>\x80-\xff]
    $output = preg_replace('/([<\'"&>\x80-\xff])/e', "'&#' . ord('$1') . ';'", $string);

    # return the result
    return $output; 
}

So if my input is Judge-Fürstová Mila & Judge-Fürstová Mila

I will get Judge-F&#252;rstov&#225; Mila &#38; Judge-F&#252;rstov&#225; Mila

But I think since I am using PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" to handle all my special characters, so if my input is something like

Judge-Fürstová Mila & Judge-Fürstová Mila

now will returns,

Judge-F&#195;&#188;rstov&#195;&#161; Mila &#38; Judge-F&#195;&#188;rstov&#195;&#161; Mila

Which is incorrect for XML I think.

So I think I should just convert <, >, &, ‘ and “ only but not other special characters like ü or á

Any ideas I how I can do this? Or maybe I have thought/ understood the problem incorrectly and there are other better ways to solve this problem?

EDIT:

I was wrong, as I just changed the function which only converts <, >, &, ‘ and “

$output = preg_replace('/([<\'"&>])/e', "'&#' . ord('$1') . ';'", $string);

XML still does not accept the converted code below,

Judge-Fürstová Mila &#38; Judge-Fürstová Mila

I cannot think of any other reason why it does that! Any ideas?

  • 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-02T11:27:11+00:00Added an answer on June 2, 2026 at 11:27 am

    You want htmlspecialchars(). Don’t let the name throw you off. It by default converts only the characters you’ve listed.

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

Sidebar

Related Questions

This is related to my previous question , but it seems I have another
This question is a more special case of the problem described (and solved) in
This seems to have been asked before: rails decimal precision and scale But when
I have another problem that I can't solve I have a following code that
This seems to be a simple problem, but after a while of searching I
We have inherited a vb.net 2003 web project, it seems to reference another web
I have another Richfaces question which may seem rather weird. I am developing a
I have another question and I can't seem to find anything on Google. What
i have another question on getting my XML serialization neat, which i can't seem
I have an curious zombie bug that seems to have crept out of 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.