php - Error when trying to parse XML from SVN log command -
i'm trying build simple drop down display revisions of specific file. option chosen, use jquery fetch current text contained in revision , populate textarea (using svn cat).
the header in html file:
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
my shell command:
svn log --xml "file:///c:/documents , settings/username_here/desktop/svnrepo/web/trunk/my_file.php"
xml parsing call:
$xmldata = simplexml_load_string(utf8_decode(trim(shell_exec($cmd))));
at point, error:
input not proper utf-8, indicate encoding ! bytes: 0xe9 0x20 0xe7 0x61
-i'm using utf8_decode function display characters properly. instance, "é" gets displayed "é"
-if change meta tag utf-8, displays properly. however, need have iso-8859-1 per organizational set rules
-i'm calling svn repo using file:/// protocol temporary measure moment
funny enough, jquery call necessitated header call display characters (shell_exec(svn cat...)):
header('content-type: text/html; charset=iso-8859-1') ;
per comments, removed utf8_decode function when reading in xml , applied when displaying text.
echo '<select id="selid">'; foreach ($xmldata->logentry $entry){ echo utf8_decode('<option value="'.$entry['revision'].'">rev '.$entry['revision'].' '.$entry->author.' @ '.substr($entry->date,0,19).' '.$entry->msg.'</option>'); } echo '</select><input type="button" id="svn_select" value="load revision" />';
works charm now.
Comments
Post a Comment