Excuse me PHP read txt related issues, Unicode-encoded
Source: Internet
Author: User
Ask PHP to read the TXT problem, Unicode encoded
A.txt content is as follows
1 Sheets 319,731,114
2 Li 419,671,029
Word lengths are 5-bit, 10-bit, 8-bit
Remove the top two bits.
$file _dir= "A.txt"; The Open File
$FP =fopen ($file _dir, "R");
$content 1=fread ($fp, FileSize ($file _dir));
$arr =array ();
$bom =substr ($content 1,0,2);//Remove file header
$content =substr ($content);
$arr = $content;
$arr =explode ("\ n", $content);
In the substr when found a number of * *, can take the right, now the trouble is Chinese out to garbled, ask how to convert?
In addition, to generate a new TXT text, but also Unicode is not the way?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service