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

  • Home
  • SEARCH
  • 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 760395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:42:44+00:00 2026-05-14T15:42:44+00:00

I have some xml files with figure spaces in it, I need to remove

  • 0

I have some xml files with figure spaces in it, I need to remove those with php.
The utf-8 code for these is e2 80 a9. If I’m not mistaken php does not seem to like 6 byte utf-8 chars, so far at least I’m unable to find a way to delete the figure spaces with functions like preg_replace.

Anybody any tips or even better a solution to this problem?

  • 1 1 Answer
  • 1 View
  • 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-14T15:42:45+00:00Added an answer on May 14, 2026 at 3:42 pm

    Have you tried preg_replace('/\x{2007}/u', '', $stringWithFigureSpaces);?

    U+2007 is the unicode codepoint for the FIGURE SPACE.

    Please see my answer on a similar unicode-regex topic with PHP which includes information about the \x{FFFF}-syntax.

    Regarding you comment about the non-working – the following works perfectly on my machine:

    $ php -a
    Interactive shell
    
    php > $str = "a\xe2\x80\x87b";  // \xe2\x80\x87 is the FIGURE SPACE
    php > echo preg_replace('/\x{2007}/u', '_', $str); // \x{2007} is the PCRE unicode codepoint notation for the U+2007 codepoint
    a_b
    

    What’s you PHP version? Are you sure the character is a FIGURE SPACE at all? Can you run the following snippet on your string?

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

    On my test string this outputs

    61 e2 80 87 62
    a  |U+2007|  b
    

    EDIT after OP comment:

    \xe2\x80\xa9 is a PARAGRAPH SEPARATOR which is unicode codepoint U+2029, so your code should be preg_replace('/\x{2029}/u', '', $stringWithUglyCharacter);

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

Sidebar

Related Questions

I have some php files in a server which generate xml code in them.
I have some XML files of this form: <?xml version=1.0 encoding=utf-8?> <?xml-stylesheet type=text/xsl href=biomirror.xsl?>
I have some XML files that contain different function information. I am trying to
I have some xml files that contain text, which are displayed on my website.
I have some XML files which are used to generate my webpages, however I
I'm working on a windows phone project where I have some xml files with
Has anyone had this problem? My projects tend to have some long XML files
I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I
I have a MVC3 application with some XML files on the App_Data folder. To
Do you have some predefined set of targets which all build.xml files you create

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.