Questions about -K and /u


#1

I don’t understand what -K and /u mean.

The pickaxe says -K “specifies the code set to be used”, but to be
used for what? Specifies the code set of the source code? It affects
to the internal representation of strings? It affects regexps?

Besides those questions, I played a bit around to try to figure this
out without luck:

I saved a simple Ruby test script in UTF-8. This test script has a
simple regexp with an accented character that filters external test
data in Latin-1 converted to UTF-8 with iconv. The matching succeeded
no matter whether I used -Ku or /u. In any of the four combinations
it succeeded. Why?

As you see I don’t have the ideas ordered about this, if it is more
simple to explain the picture instead of answering that please feel
free.

– fxn