[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

$KCODE reference documentation

Denis Mertz

4/24/2005 12:06:00 PM

Hello, i know that one can use $KCODE to set the charset encoding, but do
not find anymore where this is documented. Any pointers for that ?

Thanks

Denis

2 Answers

Bertram Scharpf

4/27/2005 7:59:00 PM

0

Am Sonntag, 24. Apr 2005, 21:04:31 +0900 schrieb dm1:
> Hello, i know that one can use $KCODE to set the charset encoding, but do
> not find anymore where this is documented. Any pointers for that ?

As far as I see when the source code is read the `-K' option
and the inline pragma (`# -*- ...') apply. After that,
`$KCODE' only influences what Regexp's dot (`/./') does.

But that's just a guess.

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...


Mark Hubbart

4/27/2005 11:39:00 PM

0

On 4/27/05, Bertram Scharpf <lists@bertram-scharpf.de> wrote:> Am Sonntag, 24. Apr 2005, 21:04:31 +0900 schrieb dm1:> > Hello, i know that one can use $KCODE to set the charset encoding, but do> > not find anymore where this is documented. Any pointers for that ?> > As far as I see when the source code is read the `-K' option> and the inline pragma (`# -*- ...') apply. After that,> `$KCODE' only influences what Regexp's dot (`/./') does.> > But that's just a guess.
It also affects legal names:
--#!/usr/bin/env ruby -Ku
Ï? = Math::PIâ?? = -(Time.now - Time.now)â?? = "300mg Xanax"def â??(n) Math.sqrt(n) enddef â??(n) n**(1/3.0) end
puts "Ï? = #{Ï?}" # Piputs "â?? = #{â??}" # Deltaputs "â?? = #{â??}" # Perscription symbolputs "â?? 144 = #{â?? 144}" # Square root symbolputs "â?? 27 = #{â?? 27}" # Cube root symbol--
The preceding script only runs properly with the kcode set to utf-8,due to the unusual variable and method names (some of which may beunreadable on some systems).
It seems there might be other effects, to; but basically setting thekcode should make ruby "really like" the character encoding.
cheers,Mark