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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:17:37+00:00 2026-05-28T01:17:37+00:00

My DB has some text which is probably copied and pasted from word document

  • 0

My DB has some text which is probably copied and pasted from word document contains some curly quotes and curly apostrophes. PHP code is generating XML data/document with this text as one of its XML element.

This is the error I’m getting when I try to display the XMl doc

This page contains the following errors:

error on line 40 at column 1: Encoding error

Below is a rendering of the page up to the first error.

I’ve tried as mentioned in the post here, but it isn’t working for me. Also tried

$output = iconv(‘UTF-8’, ‘ASCII//TRANSLIT’, $input);

as mentioned here. This one displays the text till curly quotes or apostrophe appears. Do I need to mention any different character output format here?

Is there any function available in PHP to handle these type of special characters when generating XML document. I am using <?xml version="1.0" encoding="utf-8"?> character encoding for XML documnet

Here is some of my code

header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>';

$item = mysql_fetch_object($result);
<listitems>
    <item>
        <name><?=htmlspecialchars(stripslashes($item->name))?></name>
        <details><?=htmlspecialchars(stripslashes($item->details))?></details>
        .
        .
        .
        .

    </item>
</listitems>
  • 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-05-28T01:17:38+00:00Added an answer on May 28, 2026 at 1:17 am

    on the table it says DEFAULT CHARSET=latin1

    It could be that you are fetching ISO-8859-1 data and outputting it as UTF-8. That would result in invalid characters beyond the 128 basic ASCII characters.

    Try this iconv():

    $output = iconv(‘ISO-8859-1’, ‘UTF-8//TRANSLIT’, $input);

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

Sidebar

Related Questions

I have a JeditorPane which has some text in HTML format. When I execute
I have a custom UITableViewCell which has an image & and some text. When
How can i easily parse a document which has this structure description some line
I have a Project model and it has some text attributes, one is summary.
I just want a simple SVG image that has some arbitrary text on an
I have some text that has HTML hyper-links in it. I want to remove
Let's say I have some original text: here is some text that has a
I have model Article it has field title with some text that may contain
I have a simple WPF (XAML) file that has some animated shapes and text.
I've a text file with 2 million lines. Each line has some transaction information.

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.