Import HTML, XLS, UTF and MySQL
I am using this Drupal module: http://drupal.org/project/import_html and it works well. I had to edit the XLS transformation file extract both the STYLE and BODY tags. This all works fine. The issue is that I need to surround the STYLE and BODY code with STYLE and DIV tags to make the HTML usable. I tried to insert <style> in the XLS file but none of these work: <style> <style> <style= The first generates an error b/c it's read as a tag. The second two are taken literally, and not parsed. I put the above texts inside of an <xsl:text> tag. I couldn't figure out how to get the output to be <style> so instead I wrote a PHP script to look through the DB, extract the code, do a preg_replace and __STYLE__ for example, and replace that with <style> and then update the DB. This actually works fine. The only PROBLEM is that there are UTF characters (Hebrew to be specific) in the data and when I run my PHP script, it converts them to garbage question mark signs. I have PHP 5 and MySQL 5 on my Win 2K system. Can anyone suggest a way either to get <style> to come out of the XLS or to update the DB via PHP without losing my UTF chars? Thanks, Fred
Quoting Fred Jones <fredthejonester@gmail.com>:
The only PROBLEM is that there are UTF characters (Hebrew to be specific) in the data and when I run my PHP script, it converts them to garbage question mark signs. I have PHP 5 and MySQL 5 on my Win 2K system.
You may want to look at PHP functions htmlspecialchars_decode, html_entity_decode and utf8_encode.
Can anyone suggest a way either to get <style> to come out of the XLS or to update the DB via PHP without losing my UTF chars?
For the ``input filter'' add the <style> tag as a valid tag. For instance if you're using Html Filtered Input then see admin/settings/filters/1/configure for the configuration of valid tags. Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
The only PROBLEM is that there are UTF characters (Hebrew to be specific) in the data and when I run my PHP script, it converts them to garbage question mark signs. I have PHP 5 and MySQL 5 on my Win 2K system.
You may want to look at PHP functions htmlspecialchars_decode, html_entity_decode and utf8_encode.
Thanks for your help. The answer was to add: mysql_query("SET NAMES utf8"); to setup UTF in my PHP code. Thanks for your help!
participants (2)
-
Earnie Boyd -
Fred Jones