Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Encoding Problem - Parsing An Xml File


I have a problem while parsing an xml file. The file is a backup from moodle (moodle.xml). When i open the file with one of my editors and setting Encoding to utf8 font courier standard or greek characters the editor can see all greek strings contained within the file perfectly. On the other hand when i try to open it with php parse it and then display it on a web page the data from the file come out like latin characters like (A~ atilde)(o: o umplaud) and others
like this. Updating moodle is not an option so i have to find a workaround. Has anybody heard of something like this?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Find Out Encoding Of A File With Php, And Convert It To UTF-8 Encoding
In my script I need to find out the encoding of a file and in case it
is not of the kind UTF-8 I need to convert it to that format.

Saved File Encoding
I am querying a database and saving the results as a tab-delimited file.  Is there a way to force the saved file to open in a certain encoding such as ISO Latin 1? Also, what is the best way to deal with carriage returns in the data I am saving?

Question About File Upload Encoding
If I drop a form onto my page that allows file uploads, I know well
enough how to handle the file upload in the server side via PHP.

However, I have a question: when my browser actually *sends* a binary
file (e.g., an image), does it encode it somehow for the upload? Or
does it simply send a raw bytestream?

The reason I am asking is that I am in the process of transferring some
images from one photo gallery to another (in Drupal). Mapping the two
database schemas has proved to be a little tricky, and I am thinking
it would be simpler to use the web interface to re-upload the various
images.

However, rather than do it one at a time, I'd just as soon write a PHP
script that would traverse through the old photo gallery files, and
upload them via HTTP POST (along with other relevant details, such as
descriptive text) and let the web interface make sure that the
database.

I'm comfortable with regular HTTP POST mechanisms, and doing them
programmatically with PHP, but I've never uploaded files that way.
Anything I should know? For example, do they need to be encoded
somehow before upload? Or can I just read in the raw bytestream, and
voila, there we go?

Error While Encoding A Txt File To Win-1252
I have a problem with encoding a file .txt to win-1252.

$text = recode_string("ISO-8859-1..win-1252", $text);

but I get the following error message:

Fatal error: Call to undefined function: recode_string()

the same when I trie to recode the whole file

with recode_file.

Saving XML File With Iso-8859-1 Encoding Fails
The question might sound (and probably is;-) stupid, but why doesnt the
follwing code work?? Is there something i dont see?

$doc = new DOMDocument(Ƈ.0', 'iso-8859-1');
$doc->formatOutput = true;

$root = $doc->createElement('root');
$root = $doc->appendChild($root);

$head = $doc->createElement('head');
$head = $root->appendChild($head);

$title = $doc->createElement('title');
$title = $head->appendChild($title);

/* probably the real sign gets killed,
so here is the html: ä (an umlaut) */
$text = $doc->createTextNode('ä');
$text = $title->appendChild($text);

echo $doc->saveXML();

File Parsing
I have a file, and I want to start searching it at a certain location, not from the begenning. I use strpos() to find a certain string in the file, and I would like to use a regular expression on the rest of the file after that point returned by strpos().

Parsing A DBF File
I'm attempting to read and parse a DBF file that's been created by an accounting application in place. I'm wondering if anyone can point me to any resources that explain how DBF files are designed. PHP Code:

Parsing A Txt File
I would need a "script" that parses the following information in
'outdoor.txt'.
What i actually need are those variables (for example $yTemp). I'd do it
myself but my knowhow lacks ;D
outdoor.txt is input and variables are "output" which i need to make graphs
(jgraph)

-------OUTDOOR.txt-------
Date; Time; Temp øC
21.11.2003; 18:21:39; -2.69
24.12.2003; 23:10:45; 0.06
01.01.2004; 00:00:29; -5.75
01.01.2004; 00:43:37; -6.13
03.01.2004; 22:13:38; -8.44
05.01.2004; 07:38:58; -4.06
05.01.2004; 09:33:19; -4.50
-------OUTDOOR.txt-------

i know how to read the last line and get three variables:
....
$in_part = explode(";", $lastRow);
$in_pvmOUT = $in_part[0]; // Date = 05.01.2004
$in_aikaOUT = $in_part[1]; // Aika = 09:33:19
$in_lampoOUT = $in_part[2]; // Temp øC = -4.50

But i don't know how to get more values at once and feed it to the array:

Values should be in the following format:
$yTemp = array(-2.69, 0.06, -5.78); // Average temperatures for each month
$xAverage = array("Nov 2003","Dec 2003","Jan 2004");

It actually has values for every minute and every day.
So how should it be done if i want to draw a graph for "today", say
5.1.2004.
$yTempToday =
array(-4.38, -4.44, -4.44, -4.44, -4.44, -4.44, -4.44, -4.50, -4.50, -4.50,
-4.50, -4.44, -4.44, -4.50);
$xTimeDecimal = array(9.40, 9.42, 9.43, 9.45, 9.47, 9.48, 9.50, 9.52, 9.54,
9.56, 9.58, 9.59, 9.61, 9.63);
or $xTimeActual = array("09:23:37", "09:24:42", "09:25:46", "09:26:51",
"09:27:56", "09:29:00", "09:30:05", "09:31:10", "09:32:15", "09:33:19",
"09:34:24", "09:35:29", "09:36:34", "09:37:39");

-------OUTDOOR.txt-------
Date; Time; Temp øC
21.11.2003; 18:21:39; -2.69
24.12.2003; 23:10:45; 0.06
01.01.2004; 00:00:29; -5.75
01.01.2004; 00:43:37; -6.13
03.01.2004; 22:13:38; -8.44
05.01.2004; 09:23:37; -4.38
05.01.2004; 09:24:42; -4.44
05.01.2004; 09:25:46; -4.44
05.01.2004; 09:26:51; -4.44
05.01.2004; 09:27:56; -4.44
05.01.2004; 09:29:00; -4.44
05.01.2004; 09:30:05; -4.44
05.01.2004; 09:31:10; -4.50
05.01.2004; 09:32:15; -4.50
05.01.2004; 09:33:19; -4.50
05.01.2004; 09:34:24; -4.50
05.01.2004; 09:35:29; -4.44
05.01.2004; 09:36:34; -4.44
05.01.2004; 09:37:39; -4.50
-------OUTDOOR.txt-------

PHP Not Parsing All The XML File?
Can some one help me out with this? I am trying to parse this xml file but my code is not parsing the whole file. Code:

Parsing A .doc File
is there a way to get the contents from a .doc file that's readable im using get_file_contents but it's coming out very weird:

     $filename = $renamed_cv;
     $content = file_get_contents("cvs/$filename");
     $cv_for_mysql = mysql_real_escape_string($content);

Parsing A Big Xml File Gives Seg Error
Hi, I'm parsing a *very* big xml file (600MB+) in order to do multiple inserts into a mysql table, but after about 80,000 inserts (5 minutes) I get a seg fault and obviously the script stops. I'm expecting it to get up to around 1 million rows.

The method I'm employing to read the file in follows and then one of my xml_element handlers does the insert, which i didn't bother
showing for the sake of brevity.

<?
# snipped code
function grab_file($parser,$file) {
#<snip>
while($data = fread($handle, 4096)) {
xml_parse($parser, $data, feof($handle));
}
#<snip>
}
$parser = xml_parser_create();
xml_set_element_handler($parser, "start_xml_element", "stop_xml_element");
xml_set_character_data_handler($parser, "character_xml_data");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
grab_file($parser, $file);
xml_parser_free($parser);
?>

The script itself seems to be working fine as I tested it with much smaller data set and it went like a breeze, so I'm assuming this is coming down to system resources.

Under normal load the box has about 20MB of free memory (64MB max) and about 300MB swap space (400MB+ max). Just before my seg fault, free mem had fallen to less than 1MB and swap space was down to 200MB, the 'size' of the script in ps view was
200MB+

So, when I'm reading this file in, does php not just buffer the 4KB that it's useing for that particular loop? and throw it away when finished? This doesn't seem to be the case, but I'm confused as to how the script can be taking up 200MB, possibly the xml parsing functions are buffering the whole thing?

In short, how can I keep memory useage down (by a large factor)?

File Data Parsing In PHP
Could someone show me how to parse data in a text file using PHP and
store the data in variables and MySQL?

We have text files that contain information that looks something like
this:

EXAMPLE : Elephant
OBJECT : Animal
LOCATION : South Africa
LOCATION : America

EXAMPLE : Water Lily
OBJECT : Plant
LOCATION : Manila

EXAMPLE : Panda
OBJECT : Animal
LOCATION : China

… and so on…

How can I manipulate the data inside a file? The data should be
stored in a MySQL tables considering the relationship of every data
element.

Parsing Stats File
Right now, I have a bunch of stats files from the NHL that are in the format of:

"TYLER ARNASON CHI 3 1 1 2 0 0 0 0 1 0 11 9.1"

Those aren't tabs, they are just a bunch of single spaces.

Now, I want to be able to either a) replace the spaces between each field (not between the first and last name) or b) break each field value down into a variable. Any ideas or tips?

Parsing A Dynamic RSS File
I'm a bit new to PHP, so please bare with me. I've been studying
it for a couple of months now and really like it. On the main page of
my website, I would like to include a small box that lists the title of
the latest blog entry (as well as making that a link to the entry) to
my WordPress blog. I was thinking about parsing the RSS for this, but
I'm not sure how to parse a dynamic RSS feed. Or is there some simpler
way of doing it and I'm trying to overprogram?


Parsing .htaccess File
I want to parse the contents of an .htaccess file from within PHP. The
contents of the .htaccess file looks like this:

<Files foobar.tar.gz>
AuthType Basic
AuthUserFile /foobar
AuthName "Foobar"
<Limit GET>
Require user FOOBAR
</Limit>
</Files>

And so on. When I read in that file with the following code:

$fd = fopen(".htaccess", 'rb');
while (!feof($fd)) {
$line = fgets($fd, 1024);
echo "|".$line."|
";
}
fclose($fd);

Then I get empty lines for those lines containing <Files ...>,
<Limit ...> and so on. How can I get at those lines as well?

What I need to know is basically the information "which user can access
which file?"

Include File Without Parsing It
On my server, what I am planning on doing is having users be able to upload their own HTML files, image files etc etc -- and then... (long story short) be able to have my own self-contained "virtual" web hosting, where the users get a certain amount of space to use.

Their files would therefore be uploaded like regular files, right onto the filesystem; this is fine, except I don't want these users to have access to PHP in their files (which comes inevitably if they have their files on the filesystem). My web host has it enabled to where .html files are processed in PHP (I have to have it this way anyway, because my whole site is using PHP with .html extensions).

My solution to restricting my users files from having access to PHP is by using tricky .htaccess and Not Found pages -- to when a request comes up for URL for example, it will call my Not Found script. The Not Found page will locate the user's file (which is located in a separate folder) and transparently "include()" the requested file, not parsed by PHP.

So, inevitably it comes to this: is there some way that I can use some tricky functions (preferrably string functions, they're quicker, but if all else fails: regular expressions) to scan the requested user file before it is outputted and remove all <? and <?php and <SCRIPT LANGUAGE="php"> in the file.

Parsing XML File Out Of Memory?
What I'm doing is the following:
- Load XML data a file
- Parsing the XML data
- Printing some parsed content

The problem is that the script execution is stopping before all the
content is parsed and printed.
Maybe the PHP is out of memory after a while. That would make sense
since the XML file is about 2 MB.

Parsing Text File
I'm working with a text file that contains the names of websites and their corresponding URLs in the following fashion: <a href="www.cnn.com">CNN News</a>
Each site and title is separated by line breaks. I'm not very experienced with fopen, fread, etc. and was wondering if anyone could give me pointers on how to go about reading the text file line by line and saving the URL and title in separate columns in a database.

Oh, and one more thing. The categories of these sites are also included every so often. I was hoping to save the category in a third field. Ex:

News ( new line here)
<a href="www.cnn.com">CNN News</a> ()
<a href="www.bbc.com">BBC News </a> etc.

Parsing An XML File Into A Table
I'm trying to parse an xml file into a table on a webpage.

I'm using php5 which, I believe, doesn't support xsltproc anymore (since xml support was rewritten for php5).  I have got it working on my home server using xsltproc and an xsl file on the command line (unix) but I want to transfer it to a host which doesn't have xsltproc installed and have the xml file parsed into a table by php because I know it can be done.

The actual page that I'm trying to parse is here

Can anyone give me any pointers/links/howtos for parsing xml files into a table using php?

Parsing XML Feed Without File Functions
I've written a php script to parse a remote XML file. This works fine on my test server however, the chap I've written the script for is using a hosting service which has disabled the file functions. Is there any way of parsing the xml file without access to the File or Curl functions?

Script is below:

if (!($fp=@fopen("http://server/xmlfeed.xml", "r"))) die ("Couldn't open XML.");
$count=0;
$element=array();
$state=''

function startElementHandler ($parser,$name,$attrib){
global $count;
global $element;
global $state;

switch ($name) {
case $name=="SELECTION" : {
$element[$count]["child1"] = $attrib["child1"];
$element[$count]["child2"] = $attrib["child2"];
$element[$count]["child3"] = $attrib["child3"];
$element[$count]["child4"] = $attrib["child4"];
$element[$count]["child5"] = $attrib["child5"];
break;
}
default : {$state=$name;break;}
}
}

function endElementHandler ($parser,$name){
global $count;
global $element;
if($name=="SELECTION") {$count++;}
}

function characterDataHandler ($parser, $data) {
global $count;
global $element;
}

if (!($xml_parser = xml_parser_create())) die("Couldn't create parser.");
xml_set_element_handler( $xml_parser, "startElementHandler", "endElementHandler");
xml_set_character_data_handler( $xml_parser, "characterDataHandler");

while( $data = fread($fp, 4096)){
if(!xml_parse($xml_parser, $data, feof($fp))) {
break;}
}
xml_parser_free($xml_parser);

Parsing CSV-file And Adding CSS To Style
I'm parsing a CSV-file into a table on a webpage - and I'd like to be
able to change the alignment for the _last_ <td> in each <tr> - but, as
the file is today, it's not possible for me to assign a CSS-class on
only the last <td>. I was wondering if anyone could give me a clue as to
what I need to change in the following code, to make this possible (I'm
assuming I need to have each <td> present in the code, so as to be able
to assign a class to the last one, but how? I can tell as much as that I
know the number of <td>'s in each CSV-file - they are a constant).

Here is the code:

<?php
class csv{
/* This class builds a html table from the contents of a CSV file. */

var $html = ''

function csv($csvFile){
if(!$csvHandle = fopen($csvFile, 'r')){
$this->html .= "Couldn't open $csvFile.";
}
else{
$this->html .= "<table id="dusjkabinetter">
<thead><tr>

<th id="th2" valign="top" align="left">Prod. nr:</th>

<th id="th3" valign="top" align="left">Bilder:<br />(klikk
for større visning):</th>

<th id="th4" valign="top" align="left">Beskrivelse:</th>

<th id="th5" valign="top" align="left">Pris:</th>

</tr>

</thead>
";
while(($row = fgetcsv($csvHandle, filesize($csvFile))) !== false){
$this->html .= "<tr>";
foreach($row as $field){
$this->html .= "<td>$field</td>";
}
$this->html .= "</tr>
";
}
fclose($csvHandle);
$this->html .= "</table>

";
}
}

function getHtml(){
return $this->html;
}
}

echo <<<TABELL_START
<div class='t_tabell'>
TABELL_START;

$html .= "<h2>Dusjkabinetter</h2>
";
$mycsv = new csv('csv-filer/dusjkabinetter.csv', ' ');
$html .= $mycsv->getHtml();

echo $html;

echo <<<TABELL_SLUTT
</div>
TABELL_SLUTT;
?>

Skip First Line When Parsing An Xml File
I have an xml file which I cant change, the problem is that the
first line looks like this <?xml version="1.0" ?> with the rest of
the xml being fine. However when I try to parse this I am getting a
malformed xml error. THis line was added recently, the parser worked
before. My question is how can I get rid of this first line in the
xml file - which I get from an internet feed using
fopen("http://dsfsf.com/sdf.xml", r);

Parsing An Mbox File Without Imap?
I have an mbox mailbox on a linux server that I need to open and
parse, message by message, looking for content via PHP. However, for
whatever reason, my hosting provider has not compiled PHP with IMAP
support.

Does anyone have anything written that I can download and use (free
would be nice, heh) to parse my mailbox looking for keywords and
delete/expunge/forward/autoreply based on what I find?

Doesn't need to be super fast for processing speed as I'm the only one
using it and wil only run it once or twice per day on a few MB of
Email. I just don't want to reinvent the wheel if someone out there
has what I'm looking for.

Parsing Out A File Using Special Characters
I am creating a site where someone would enter data into a few text boxes, with the potential for them to be fairly long.  I am therefore saving them into a text file instead of a database. 

With these, there is a potential for someone to use the enter key in these boxes, therefore making it very difficult to just parse it out by line. I am currently trying to figure out how to parse it by special characters (or groups of characters such as "%%$$%%" or something that noone would ever type, on purpose or by accident) 

I was wondering if there was a way to parse this out by these special characters, or if there was a way to save those line returns that the people enter as something other than a line return.

Accessing CSV File For PHP Parsing From Remote Server
What function can I use to grab a .csv file from a remote webserver for
use in my PHP script. I want to do some parsing and statistical
analysis on it (server side).

What PHP function is used for this? I can't seem to find it in Google
or the online PHP manual, because I don't really know what keywords to
use.

.htaccess - Parsing A PHP File With A .html Extension?
Can I use .htaccess to parse a PHP file with a standard .html extension?? This doesn't seem to work:

AddType text/html .html
AddHandler server-parsed .html

I'm using a remote host, so modifying the server's .conf file isn't really an option nor is modifying the php.ini file.

Parsing Ascii File Into Multi Dim. Array
I am trying to load a txt file into a multidimensional array. Eech line in the txt file has 3 fields, delimited by a | i.e.

field1|field2|field3
field1|field2|field3
...

This is the code I have right now that adds each line to an array PHP Code:

Domxml - Parsing An Xml File Once Per Session Rather Than Every Time
I am working on an embedded system. The entire configuration for the
system is stored in an XML file, which is pretty long.

It takes about 3 seconds to open the file using domxml_open_file.

Breaking the file into smaller files is not possible; a single XML file
is a part of the design requirement.

Right now we're opening and freeing the file every time any data is
requested from the file, which is quite often. This means that the user
ends up waiting about 5 seconds total before the page is generated.

It would be nice if we could open the file once per session, and keep
the file open throughout the session, rereading only when the file on
disk changes.

Parsing A RSS Feed And Generating A Static .html File With PHP
I have this small project for my site, if you can't point me to some resources or help me out I'll thank you very much.

The homepage of my site points to the different services I offer (chats, forums, my blog and a podcast for spanish speakers). I want to make this homepage more dynamic, but since the homepage gets more than 10000 daily unique visitors I don't wanna make it a .php file ('cause my hosting provider might get mad with the server's resources).

So what I need is to program a php script that I would run on-demand (probably 1 or 2 times a day) and that would make this:

- Parse the RSS feed of my blogs and the forums
- Generate a static .html file (the homepage) with the normal content plus the headlines from the feeds.

That way everytime I update my blogs I could run that php script to re-generate the homepage, with the updated info from the feeds.

Any help, suggestions, comments, links on how to do this will be very helpful. I'm not very experienced with PHP (I come from J2EE development), but I'm armed with 2 PHP books as a reference.

URL Encoding
In one of my PHP applications, I generate a dynamic link to another page. The parameter list contains a few variables with some special characters, so as expected, I use urlencode() to encode the parameters before plopping them into the URL.

For some strange reason, the link doesn't work - I get a "page cannot be displayed" error in IE 6. NS 6 starts to load it, then just stops. Oddly enough, if I go into the location bar (under IE at least), and delete one (1) character, any character from this one particular parameter (search_expr), the page loads fine (albeit with a messed up parameter). Code:

URL Encoding
Can anyone point me in the direction of a tutorial on URL encoding? I am creating a website and i want to use 1 page which contains the layout, then seperate pages with the content. i would do it something similar to this:

http://website.com/index.php?page=links

Then that would just call up a .inc page specified in the page= variable and display it on index.php.

Php Encoding
i was wondering, which is a good-freeware php enconding alternative?
Im running the apache server on a windows platform.

Encoding
I have a problem. How can I transform this xml:
$xml="<name>Niccol&#xF2;</name>"
to this
$xml="<name>Niccolò</name>"

I recive by CURL from a site this xml:

<?xml version="1.0">
<name>Niccol&#xF2;</name>

but, for some reasons, I want:

<?xml version="1.0">
<name>Niccolò</name>


Which Encoding?
Not really a PHP question, but i've got an app that sends me this type of
encoding:

á (&aacute;) translates to %C3%A1
ñ (&ntilde;) translates to %C3%B1

i've tried several decodings with PHP without any good result.
Anyone knows which type of encoding is this and which function to use in
order to decode it with PHP?

Encoding
my website is parsing 4 external xml files (rss feeds) and writes them in a mysql database. my problem is that 2 of the xml files are encoded in utf-8 and 2 of them are windows 1250. when i need to retrieve the data from the database and display it on my site (which is utf-8) i have a problem with special characters that are encoded in windows 1250. I need all the data in my database to be encoded in one way. how to do that ? or is there another way?

Help On Character Encoding
I have a string in windows-1256 character set. But i would like to change from this chracter set to utf-8. (actually it is for to display arabic text). I am using in my whole site utf-8.
Any help highly appreciated.

Chinese Encoding
I have a forum mainly in Chinese character. There are some characters which cannot be shown correctly and turn into "& #22175" ... does anyone know how to fix this?

Email Encoding
I'm using the code below to send emails right now. Its is secure?

Low-end PHP Encoding For Windows
FYI, BadBlue added a built-in PHP encoding capability to the enterprise version of their Windows web server. The personal edition of the server is a free download and is a quick easy way to get PHP running: http://badblue.com/helpphps.htm .

Encoding Problem
I have a dom tree representing the content of a html document. In the xml I
use &#x20AC; as the euro sign. I think I need to do this to be able to use
xsl transformations. After the xsl transformation I use a small SAX
parser. But my &#x20AC; gets converted to: â,¬50.
I've tried passing xml_parser_create() 'UTF-8' and '' (hint from php.net)
but it only makes things worse ( ? or squares are displayed ).
How do i have to encode characters to be able to pass them to SAX. Is there
a build in function or do I use str_replace()?

Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
The soul would have no rainbow had the eyes no tears.

GB2312 Encoding In PHP
I have language text stored as variables in text files, which are
'included' by my PHP scripts (is there a better way?). However, I seem
to have a problem with the simplified chinese GB2312 encoding format.

I thought that most foreign encoding mechanisms would avoid the use of
the quotation mark - however, I saved something out as GB2312 and now
effectively get parse errors (due to premature quotes which appear to
form parts of the Chinese characters themselves).

A few other websites I tested though don't seem to have a problem
sending me mail in GB2312 though ... so they must have somehow managed.

Locale And Different Encoding
I have a simple question about locale and PHP5.

I'm using polish characters but I encode them in UTF-8.
I was sorting an array with usort($array, 'strcoll'); but I've entred a
problem.
I was sorting arrays this way:

setlocale(LC_ALL, 'pl_PL.utf8');
usort($array, 'strcoll');

but it turned out to be completely wrong...

I've started to test various encodings on various OS and ended with
this sample PHP script
that sorts UTF-8 encoded array on both Linux and Windows with locale
encoding set to ISO-8859-2:

<? // file encoding is UTF-8
$array = array('Aea', 'Eaz', 'Eaz', 'Eaz', 'Aea', 'Aeas');

var_dump(mb_detect_encoding($array[1])); // shows UTF-8 - OK

// set locale encoding ISO-8859-2
// pl_PL for Linux
// polish_Poland.28592 for Windows
if (PHP_OS == 'WINNT') {
setlocale(LC_ALL, 'polish_Poland.28592');
} else {
setlocale(LC_ALL, 'pl_PL');
}

// sort
usort($array, 'strcoll');

// works OK on both Linux and Windows
var_dump($array);
?>

how come it works on both Linux Gentoo PHP 5.1.1 and
Windows NT PHP 5.1.4?

the contents of $array contents are encoded in UTF-8, but encoding is
set to ISO-8859-2 (via setlocale)

Php Script Encoding
this is my first "topic" on Google Groups.

I'm looking for a solution for 4 days, without results.

So... my apache is serving pages in UTF-8 but my php scripts are writed
(I'm speaking about strings) in ISO-8859-1.

How can I say at apache how to interpret my scripts in a different
charset?

I don't want to change every "è" with "&egrave;"
I think that it should be a simple configuration in the .conf or in the
..ini but... nothig found about.

SoapVar And Encoding
what's going on with the following (I'm working in non-WSDL mode).
Basically, I need the following in the SOAP request body:

<ns6:create>
...
<property>
<name>Property 1</name>
<value>Test Value 1</value>
</property>
<property>
<name>Property 2</name>
<value>Test Value 2</value>
</property>
</ns6:create>

So I've created a class called Create that has the required members,
and stores the property elements (which are instances of a class called
NamedValue) in an array:

class NamedValue {
public $name;
public $value;

public function __construct($name, $value) { ... }
}

class Create {
public $id;
public $parent;
public $type;
public $property;

public function __construct(...) {
...
$property = array(
new NamedValue("Property 1", "Test Value 1"),
new NamedValue("Property 2", "Test Value 2")
);
}
}

Euc-kr Encoding Problem
I have a dom tree representing the content of a html document.
I use character-set as the euc-kr sign.

Can I use a <?xml encoding="euc-kr" ?>
This source don't work.

How Can I use character-set as the euc-kr ?

Character Encoding In PHP & GD2?
I have been working on a dynamic image in GD2 which acts as a chatbox in a forum signature. It all seems to be working pretty well, but I have come across a bug (of sorts): if the user were to enter characters such as '¬_¬' the result in the image is shown as 'Ž_Ž'.

Is there any way that, using PHP, I can change this so that is actually understands the characters and would print '¬_¬'.?

Character Encoding
I'm working on a site for my brothers friend and it has a commentary system.
The commentaries get added by calling a Javascript which updates the current page and then call a PHP script to store the comment in a mySQL database.
My problem is at if the user uses any kind of special chars like the danish chars: æ, ø and å then the PHP script will just die on them. It will store the message until the chars and then stop.

I've tried running an escape () in the javascript on the txt i'm sending, and i've tried using CONVERT ('string' USING utf8) in the SQL query. The entire site is encoded in UTF-8, and so is the database but the user might type in ISO-8859-1 (?).

Somewhere else on the site i have a fileupload, here the page calls the upload script directly and it has no problems storing special chars in the database, so i'm thinking the problem might be a combination of the Javascript and PHP.

I'm hoping someone has an idea to what might be wrong. Code:

Detect Character Encoding?
My Problem is I want to build my own small web interface. works fine with imap_ functions so far. But now i got problems with Mails coming from MS Outlook - they are UTF-7 or UTF-8 encoded.

I don't know how to find out how they are encoded?

Second Problem: Got a character Sequence in the subject looking like that:

Ihre Anfrage: =?iso-8859-1?Q?minpoll=20timelimit=20wie=20gro=DF=3F?=

Don't know what to do with that.

Perhaps someone could drop some info on encoding.

Encoding/decoding A Variable
Is there a function that will temporarily encode a variable (say, for passing through a URL), and another that would decode the same?


Copyright © 2005-08 www.BigResource.com, All rights reserved