473,624 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preserving Chinese Characters when reading and writing text

Hello peeps,

I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and
writing MP3 tags). I have been using PHP on the command line (Mac OS X
Unix shell, to be precise), and am getting on more or less OK.

So far, I have managed to parse my tab-delimited .txt file properly into
an array, and then use this array to update the tags on a bunch of MP3
audio files. Nice.

Thing is, some of the track names specified in my text file are in
Simplified Chinese characters. These show up just fine within my .txt
file's editor (TextMate), but appear garbled within the final output.
Ack.

What I need is a way of reading and/or preserving the Chinese
characters, so that I can (hopefully) write them to my MP3 files.

I am sure some of you have already cracked this one a long time ago. I
hope you'll exercise some patience and give me a few pointers here!

I am not much more than a PHP newbie, so forgive me if I have overlooked
anything obvious :-)

--
Clive Green
May 31 '07 #1
2 4552
On May 31, 11:11 am, Clive Green <e...@clivegree n.comwrote:
Hello peeps,

I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and
writing MP3 tags). I have been using PHP on the command line (Mac OS X
Unix shell, to be precise), and am getting on more or less OK.

So far, I have managed to parse my tab-delimited .txt file properly into
an array, and then use this array to update the tags on a bunch of MP3
audio files. Nice.

Thing is, some of the track names specified in my text file are in
Simplified Chinese characters. These show up just fine within my .txt
file's editor (TextMate), but appear garbled within the final output.
Ack.

What I need is a way of reading and/or preserving the Chinese
characters, so that I can (hopefully) write them to my MP3 files.

I am sure some of you have already cracked this one a long time ago. I
hope you'll exercise some patience and give me a few pointers here!

I am not much more than a PHP newbie, so forgive me if I have overlooked
anything obvious :-)

--
Clive Green
Play with encoding choices. UTF-8 for both the text file and the PHP
functions you use if possible.

-Mike PII

May 31 '07 #2
In article <11************ **********@g4g2 000hsf.googlegr oups.com>,
Mike P2 <su***********@ gmail.comwrote:
On May 31, 11:11 am, Clive Green <e...@clivegree n.comwrote:
Hello peeps,

I am using PHP 5.2.2 together with MP3_Id (a PEAR module for reading and
writing MP3 tags). I have been using PHP on the command line (Mac OS X
Unix shell, to be precise), and am getting on more or less OK.

So far, I have managed to parse my tab-delimited .txt file properly into
an array, and then use this array to update the tags on a bunch of MP3
audio files. Nice.

Thing is, some of the track names specified in my text file are in
Simplified Chinese characters. These show up just fine within my .txt
file's editor (TextMate), but appear garbled within the final output.
Ack.

What I need is a way of reading and/or preserving the Chinese
characters, so that I can (hopefully) write them to my MP3 files.

I am sure some of you have already cracked this one a long time ago. I
hope you'll exercise some patience and give me a few pointers here!

I am not much more than a PHP newbie, so forgive me if I have overlooked
anything obvious :-)

--
Clive Green

Play with encoding choices. UTF-8 for both the text file and the PHP
functions you use if possible.

-Mike PII
Hello Mike, thanks for taking the time to add your comment.

I have a text file that is already UTF8 encoded. I suppose that I really
need to discover exactly how one reads and/or writes text strings in
such a way that double-byte characters (like Simplified Chinese Hanzi,
for example) get correctly displayed within an MP3 tag.

At the moment I am using Mp3_Id, a PEAR extension, which is working just
fine, but isn't receiving string data in the right format to display
Chinese characters within tag values.

I suspect that the answer to this issue is very straightforward . But I
am buggered if I know what it is!

Thanks again for responding, all the same. I do appreciate it!

--
Clive
Jun 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
22248
by: Zhang Weiwu | last post by:
Hello. I am working with a php software project, in it (www.egroupware.org) Chinese simplified locate is "zh" while Traditional Chinese "tw". I wish to send correct language attribute in http header, I found "zh" is not standard. I found this line in apache2's default httpd.conf # Simplified Chinese (zh-CN) AddLanguage zh-CN .zh-cn
4
3013
by: Winnie | last post by:
Hi, I am currently writing a C# Windows Application. On my form, I have several labels with Traditional Chinese text, it is ok on my machine (Windows 2000), but after install on Windows 98 or NT, these labels show questionmarks (????) instead of the chinese characters! Would someone please help me to solve it out? I don't want to use the images to replace the chinese characters. Please help and thanks!
0
724
by: Alex Chan | last post by:
Hi group, I am writing a RFC Server with SAP.NET Connector to connect to SAP. There are chinese characters passing back and forth. I found that all chinese characters sending from SAP are encoded with UTF-7. In order to let SAP display chinese characters correctly, i also need to encode my chinese data by UTF-7. However, i need to convert the UTF-7 encoded SAP data back to chinese
8
11956
by: pabv | last post by:
Hello all, I am having a few issues with encoding to chinese characters and perhaps someone might be able to assist. At the moment I am only able to see chinese characters when displayed as part of a datagrid. When an input textbox is displayed it does not display chinese characters, but rather the unicode characters stored in the mssql 2000 server backend.
4
6895
by: K | last post by:
I've an XML file in UTF-8. It contains some chinese characters ( both simplified chinese and traditional chinese). In loading the XML file with MSXML parser, I used the below code to retrieve the data in a node. The CString was then display in CListCtrl. For the traditional chinese characters, they were shown correctly, but for simplified characters, I encounted many "?", but some characters were correct.
3
2857
by: msnews.microsoft.com | last post by:
Hey there, I'm having trouble reading Simple Chinese characters from an XML document in an ASP file, I want to update the database based on what is in the file. Everytime, I read in the characters they come out as ??. Here's a snippet. Also here is my sample xml file: http://dev4.labwerks.com/research/1_homepage.xml Response.Charset = "utf-8" Set objXML = Server.CreateObject("Microsoft.XMLDOM") Set objLst =...
0
3701
by: st.frey | last post by:
I've got a problem with importing chinese characters into a mysql-table and have read several mailings but didn't find a solution. i have a utf-8 text file that contains chinese characters. the table where i want to import the data using "load data local infile" has collation utf8_unicode_ci. but after the import is done, the chinese characters are converted into so strange characters. to show the chinese symbols in a php-script i use...
5
8525
by: Figmo | last post by:
I'm having a problem working with foreign characters (well....foreign to me anyway) I have a textbox control on a form. The font is set to MS Arial Unicode. If I use the Chinese input method I can type characters into this box no problem. They display correctly. I can also copy and paste Chinese characters from web sites into this text box and they display no problem. Here is my problem. If I put some Chinese characters in the...
13
3905
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program: "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't...
0
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.