1. new in this version
  2. build a web 2.0 app in happstack
  3. why happstack is cool
  4. getting started with happstack
  5. prerequisites
  6. cabal install me
  7. first shot at happstack
  8. url handling
  9. basic HTML inclusion
  10. templates
  11. stringtemplate basics
  12. debugging
  13. form data: get and post
  14. form data: file uploads
  15. cookies
  16. introduction to macid
  17. first steps with macid
  18. scaling with multimaster
  19. using macid safely
  20. macid dummy data
  21. changing the data model
  22. macid stress test
  23. limitations of macid
  24. foreign characters
  25. IxSets
  26. cron jobs
  27. thanks
  28. appendix (floundering in ghci)

Internationalization

I had some problems displaying non-ascii characters such as ö, ä, and ü, although now everything that I want works (except for utf8 data in dummy data). I can create users with foreign characters in usernames or profile fields, jobs with foreign characters in the description, and so on.

But I wasted enough time on this that I thought I'd say a few words in hopes of saving others trouble.

First of all, if you are running this tutorial locally and are seeing escape characters in the paragraph above, set your locale by doing something like (on linux)

export LANG=en_US.UTF-8
sudo update-locale

and restart the tutorial app. Hopefully at least then this page displays properly, as it does for me.

Another tip: don't use emacs, or emacs22, to edit files with utf8 data. Supposedly emacs22 has good utf8 support, but I can't even figure out a way for emacs to tell me whether the file I'm in is in utf8 or latin1, which led to some annoying confusions. Instead, use kate (a free apt-gettable editor), use tools-> encoding to see what encoding you are seeing, and always set the kate encoding to utf8. If a tutorial template file displays properly in kate with utf8, it should display properly in the live tutorial as well.

Another annoyance: when I attempted to create dummy data with utf8 data (edited in kate) and save this to HAppS State, this did NOT display correctly. (See StateVersions.AppState1.hs) I got 123 type character escape sequences. I think this is because Serialization is based on show instances of data, and ... well...

*Main> show "ö"
""\246""
*Main> putStrLn "ö"
ö

I also had a problem where data in form textbox fields was mysteriously showing up ed. It turned out this is because I sloppily used show to escape quotes, rather than sticking a quote at the beginning and end of the string as was more proper. I then got bitten by show as above, causing much misery.

But all that having been said, as the live demo shows, in general utf8 data does work as it should.

Next chapter is about using cron jobs to keep happs running if it quits on your mysterious reasons.