I have an xml written in a file. I want in the 1st line
<code>
<?xml version="1.0" encoding="iso-88-59-7"?>
</code>
to change the encoding to utf-8 any easy way to do that?
5 3073 Dormilich 8,658
Recognized Expert Moderator Expert
code tag is [code] not <code> or use the button with the "#" symbol
the solution depends on which language you want to use for that (possibilities: any (server) scripting lanuage (C, Java, PHP, ASP, Perl,...), even XSLT)
regards
I have this XML -
<?xml version="1.0" encoding="iso-8859-7"?>
-
<asx version="3.0" >
-
<title>General Music ASX playlist</title>
-
<moreinfo href="http://www.generalmusic.com"/>
-
-
<entry>
-
<title>8.07409|1.00922|ΚΡΑΤΗΣΕ ΜΕ ΣΤΟ ΡΥΘΜΟ|9.00402||8.00|</title>
-
<ref href="UserFiles/songs/03/8.07409.mp3" />
-
<param name="image" value="UserFiles/Image/1.00922.jpg" />
-
</entry>
-
<entry>
-
<title>8.07410|1.00922|ΚΡΑΤΗΣΕ ΜΕ ΣΤΟ ΡΥΘΜΟ|9.00402||8.00|</title>
-
<ref href="UserFiles/songs/03/8.07410.mp3" />
-
<param name="image" value="UserFiles/Image/1.00922.jpg" />
-
</entry>
-
</asx>
-
and I want to change the encoding to utf-8 when I download it and by hand change the encoding,save it and upload it all is good.
I created a php script to automate the process which is here -
$id=$_SESSION['id'];
-
-
$file = fopen("../player/".$id.".xml","r");
-
$msg=fread($file,filesize("../player/".$id.".xml"));
-
fclose($file);
-
-
//$msg=str_replace("iso-8859-7","utf-8",$msg);
-
$file = fopen("../player/".$id.".xml","w");
-
fwrite($file,$msg);
-
fclose($file);
-
but then all the greeks in the xml (those in the title tag) gets destroyed any help on how can I do that?
Dormilich 8,658
Recognized Expert Moderator Expert
I think you have to actually encode the content to utf-8. use utf8_encode().
regards
OK found it before writing to the file I used iconv to change the string to utf-8
Thanks for your time!
Dormilich 8,658
Recognized Expert Moderator Expert
never mind. I'm glad I could help.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ann |
last post by:
Hi,
Is there any way to Change encoding of Java Vm to ISO-8859-1?
i am using Java vm along with an application called opencms.
I get the following error message..
Error: the encoding of your Java VM is different from
the OpenCms encoding!
Java VM file encoding: UTF-8
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: Alexander Cohen |
last post by:
How would i go about changing a databases encoding? Is this at all
possible?
There does not seem to be much i can with ALTER DATABASE except change
its name!
--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
|
by: Marc |
last post by:
Hi!
I'm working with a C# client that calls a php web service. I've
created a wrapper to call the service using .NET wsdl tool (adding a
web reference).
The call to the server works fine, it is serialized correctly, and the
server returns a response (I've captured the response and it's
correct!) but when the .NET deserialize this response, it throws the
exception "System.InvalidOperationException: There is an error in XML
|
by: Jason Chan |
last post by:
Some chinese characters data (in Big5 encoding) is stored in database.
I tried to display the data in an aspx but the characters cannot display
correctly.
I tried anything I think is related:
- Setting the charset, codepage of the page
- changed the responseEncoding in web.config to Big5
- hardcoded Response.ContentEncoding to 950 (codepage of Big5)
- Change the file encoding to Big5 (in save option)
None of them work.
| |
by: jcsnippets.atspace.com |
last post by:
Hi everyone,
Recently I have posted a question regarding special characters in text
files. I was trying to read the text file to process the text later on, but
I was using the wrong encoding. The correct encoding turned out to be
extended ASCII (850).
But now I'd like to store the result in a database. I have tried to do this
by just issueing an insert statement, using the following piece of code:
SqlCommand cmd = new...
|
by: TomislaW |
last post by:
I am sending word document with e-mail from asp.net 2.0 application.
I read doc file like this:FileStream fs =
System.IO.File.Open(docPath,FileMode.Open,FileAccess.Read,FileShare.Read);
Then create message:
MailMessage message = new MailMessage("mail@company.com", email);
message.Subject = "Subject";
message.Body = "";
ContentType ct = new ContentType("application/vnd.ms-word");
Attachment data = new Attachment(ms,ct);
|
by: Diego F. |
last post by:
Hi. I'm using that code:
If File.Exists(Ls_NombreFichero) = False Then
sw = File.CreateText(Ls_NombreFichero)
Else
sw = File.AppendText(Ls_NombreFichero)
End If
I need to change the encoding, as utf-8 is not the one I can use. How can I
change it? Encoding property is read only and I don't know how to use the
|
by: ajmastrean |
last post by:
I cannot get any (hex) number in the "0x80"-"0x89" range (inclusive)
to write properly to a file. Any number in this range magically
transforms itself into "0x3F". For instance, debugging shows that
"0x83" = UInt16 "131" and that converts to Char (curly) "f". Any
information would be helpful.
String hexNum = { "79", "80", "89", "90" };
System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(@"C:
\test.dbf", true,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |