Our (rails) app is mainly utf-8, so we set kcode to u.

However, we need to generate pdfs using the cp1252 encoding, as the
FPDF library doesn't have unicode support.
Translating strings work fine using iconv, but the library is using
sprintf internally, which blows up on non-utf8 characters.

E.g.:

s = ("" << 73 << 241 << 116 << 234 << 114 << 110 << 228 << 116 << 105
<< 111 << 110 << 97 << 108 << 105 << 122 << 230 << 116 << 105 << 248
<< 110)  # valid cp1252-string
puts sprintf("aa %s bb", s)

..which discards the last two characters of s.


Suggestions appreciated,
Isak