Fixing Borked UTF-8 Data in MySQL

While updating ownCloud to version 4 it reencoded my already UTF-8-encoded data and left me with borked strings.

I thought about trying to do a bunch of find and replace operations, but I knew this was error prone.

A little internet research produced a very simple simple solution for fixing double-encoded data in MySQL:

mysqldump -u DB_USER -p DB_PASSWORD --opt --quote-names --skip-set-charset --default-character-set=latin1 DB_NAME > DB_NAME-latin1-dump.sql
mysql -u DB_USER -p DB_PASSWORD --default-character-set=utf8 DB_NAME < DB_NAME-latin1-dump.sql

Just replace DB_USER, DB_PASSWORD and DB_NAME with the appropriate values and your good to go. 😀

Render Rails assets to string

If you ever needed a way to render a Rails assets to a string, Hongli Lai from Phusion describes how. 🙂

I prepared a Gist wrapping it into a nice helper. 😀

module ApplicationHelper
  # thanks to http://blog.phusion.nl/2011/08/14/rendering-rails-3-1-assets-to-string/
  # you may need to change the owner of the tmp/cache/* directories to the web servers user
  # e.g. for Debian systems: `chown -R www-data:www-data tmp/cache/*`
  def render_asset(asset)
    Conferator::Application.assets.find_asset(asset).body.html_safe
  end
end

 

Gefährliches Gras

Reporter zu Tepco-Pressesprecher in Die Fukushima Lüge (bei ca. 20:00min):

Haben Sie Gerade wirklich gesagt, dass Sie radioaktiv verseuchtes Wasser durch Leitungen transportieren, die durch Gras zerstört werden können?

Es ist auch sonst eine interessante Doku, die auch wieder zeigt, dass in der Branche Sinn für Verantwortung und technischer Sachverstand absolute Mangelware sind … :-/

Und dann muss ich auch noch lesen, dass der Betrieb und Ausbau (weltweit) munter weitergeht.