PHP XML encoding

I meet a same encoding problem using DOMDocument::load XML described at http://www.php.net/manual/en/domdocument.load.php.

In short, if the XML has encoding=”UTF-8″, it will be parsed properly. In my case, the XML has encoding=”windows-1252″, but it has been changed to “UTF-8”. For example, “Schütze” is changed to “Schütze”. My guess is that DOMDocument::load only recognizes  “UTF-8”, otherwise it changes other encoding to “UTF-8”.

My solution is “iconv(“UTF-8″,”windows-1252″,$str)” which changes it back to original encoding. This solution assumes you know the original encoding.

Install Subversion to Eclipse and Netbeans on Ubuntu 9.0.4

It is not my first time to install Subversion, but it is worth to record what I did. My system is Ubuntu 9.0.4 and Eclipse 3.5 and Netbeans 6.5.

Following the official documentation, I got the error in Eclipse: “Incompatible JavaHL library loaded.  1.6.x or later required.”

The reason is clear: JavaHL is not properly install or might version is too old.

Try: “sudo  apt-get install libsvn-java”, but no update.

I had to compile from source code now according to [1]. The tricky part is to let Eclipse know where is JavaHL. I tried add “-Djava.library.path=/usr/local/lib” to “eclipse.ini”, but did not work. Only “export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH” works for me.

Since Eclipse works now, it is time to try Netbeans according to [4]. Just figure out where is SVN using “which svn” and then following the instrunction.

Reference:
[1]http://en.newinstance.it/2009/05/13/making-eclipse-javahl-working-recompiling-subversion-from-the-sources/

[2]http://islandlinux.org/howto/installing-javahl-subclipseeclipse-ubuntu

[3]http://www.nileshk.com/svn_in_eclipse_subversive_and_svnkit_for_subversion_1_6

[4]http://netbeans.org/kb/docs/ide/subversion.html

Incompatible JavaHL library loaded.  1.6.x or later required.