Make shadow.rb serve unicode

Shadow is an awesome little project that gives you a tiny, zero-config REST server for your database. Just pure GET PUT POST DELETE, nothing more, nothing less. Uses mongrel for the net and AR for the db – you’ll need to point it at your database.yml.

But it didn’t do UTF8 out of the box, so let’s change that:

1
2
3
4
5
6
7
8
9
10
$ diff shadow-old.rb shadow.rb
5a6
> require 'Ya2YAML'
12a14
>     $KCODE='u'
42c44
<       out.write obj.to_yaml
---
>       out.write obj.ya2yaml
$

できた!

I really love this kind of thing. Rails is becoming a MONSTER and is a bitch to force to play with anything else on your server(s). I think we’ll see a lot more of this kind of thing – a breaking-out of small pieces of very nice Rails functionality, into a way that makes them play nicer in a team.

Tags: , ,

Leave a Reply