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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:52:51+00:00 2026-05-14T16:52:51+00:00

Content people have been using Word and pasting things into the old unicode system.

  • 0

Content people have been using Word and pasting things into the old unicode system. I’m now trying to go UTF8.

However, upon importing the data there are characters I cannot get rid of.

I have tried the following stackoverflow thread and none of the functions provided fix this string: http://snipplr.com/view.php?codeview&id=11171 / How to replace Microsoft-encoded quotes in PHP

String: Danâ??s back for more!!

  • 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-14T16:52:51+00:00Added an answer on May 14, 2026 at 4:52 pm

    In this kind of situation, I generally start with the string I have copy-pasted from word :

    $str = 'Danâ’s back !';
    var_dump($str);
    

    And, going byte-by-byte in it, I output the hexadecimal code of each byte :

    for ($i=0 ; $i<strlen($str) ; $i++) {
        $byte = $str[$i];
        $char = ord($byte);
        printf('%s:0x%02x ', $byte, $char);
    }
    

    Which gives an output such as this one :

    D:0x44 a:0x61 n:0x6e �:0xc3 �:0xa2 �:0xe2 �:0x80 �:0x99 s:0x73 :0x20 b:0x62 a:0x61 c:0x63 k:0x6b :0x20 !:0x21 
    

    Then, with a bit of guessing, luck, and trial-and-error, you’ll find out that :

    • â is a character that fits on two bytes : 0xc3 0xa2
    • and the special-quote is a character that fits on three bytes : 0xe2 0x80 0x99

    Hint : it’s easier when you don’t have two special characters following each other 😉

    After that, it’s only a matter of using str_replace to replace the correct sequence of bytes by another character ; for example, to replace the special-quote by a normal one :

    var_dump(str_replace("\xe2\x80\x99", "'", $str));
    

    Will give you :

    string 'Danâ's back !' (length=14)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a directory in the standard ASP.NET template Content where most people seem
Say you're coding some kind of web application. Something where people can contribute content,
I have a content query web part that queries by content type against a
I have some content that i have to render as a excel file in
People use frequently something like: <ListBox ItemsSource={Binding ElementName=thisControl, Path=ListIndexes}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content={Binding
Will content requested over https still be cached by web browsers or do they
What is the content type for MHT files?
I am serving all content through apache with Content-Encoding: zip but that compresses on
I am studying the content of Programming Ruby- The Pragmatic Programmer's Guide but the
I have an external website that uses Active Directory for Authentication . The propsed

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.