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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:42:10+00:00 2026-05-30T05:42:10+00:00

I’m trying to parse utf-8 encoded text files uploaded via a multipart/form-data form. I

  • 0

I’m trying to parse utf-8 encoded text files uploaded via a multipart/form-data form. I have built a small .txt file where I have entered some tab delimited (meaningless) text in both latin and Japanese characters (I copy/pasted the Jpz characters from a Jpz retail site).

All I am trying at this point is to replace new lines by (LINE) and tabs by (TAB). Here is my code:

...
$text=file_get_contents($_FILES['upload']['tmp_name']);

$LineArray=array('\r\n','\n\r','\r','\n');
foreach ($LineArray as $value){
  $pieces=(mb_split($value,$text));
  $text=implode ("(LINE)",$pieces);
}
echo "Here is the modified text:<br/>";
echo $text;
echo "<br/>";
var_dump($text);

$tab='\t';
$pieces=(mb_split($tab,$text));
$text=implode ("(TAB)",$pieces);
echo "Here is the modified text:<br/>";
echo $text;
echo "<br/>";
var_dump($text);
...

Here is a vardump of the text before modification:

string 'John    Fitzgerald  Kennedy

Winston     Churchill

John    Edgar   Hoover

素材の 生地を柿渋で染 めた和柄パンツです





火车票 火车票 火车票 火车票



' (length=175)

The first line of Asian characters has 2 tabs, the last line of the file has 3 tabs.

Here is a vardump of the text after all modifications:

string 'John(TAB)Fitzgerald(TAB)Kennedy(LINE)Winston(TAB)(TAB)Churchill(LINE)John(TAB)Edgar(TAB)Hoover(LINE)素材の 生地を柿渋で染(TAB)めた和柄パンツです(LINE)(LINE)(LINE)火车票  火车票 火车票 火车票(LINE)(LINE)' (length=235)

How come my code can only identify one of the tabs in the Japanese text part?

  • 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-30T05:42:11+00:00Added an answer on May 30, 2026 at 5:42 am

    mb_split uses the value of mb_regex_encoding to determine what encoding to process the string in. This value is probably not set to UTF-8 and hence mb_split doesn’t expect/work on the correct encoding. Try setting the mb_regex_encoding to UTF-8.

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.