|
637b82af
»
|
aslakhellesoy |
2009-01-25 |
Release 0.1.99.5 |
1 |
# Require this file if you need Unicode support. |
| |
2 |
require 'cucumber/platform' |
| |
3 |
require 'cucumber/formatter/ansicolor' |
| |
4 |
|
| |
5 |
$KCODE='u' unless Cucumber::RUBY_1_9 |
| |
6 |
|
| |
7 |
if Cucumber::WINDOWS_MRI && `chcp` =~ /(\d+)/ |
| |
8 |
codepage = $1.to_i |
| |
9 |
codepages = (1251..1252) |
| |
10 |
|
| |
11 |
if codepages.include?(codepage) |
| |
12 |
Cucumber::CODEPAGE = "cp#{codepage}" |
| |
13 |
|
| |
14 |
require 'iconv' |
| |
15 |
module Kernel |
| |
16 |
alias cucumber_print print |
| |
17 |
def print(*a) |
| |
18 |
begin |
| |
19 |
cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a)) |
| |
20 |
rescue Iconv::IllegalSequence |
| |
21 |
cucumber_print(*a) |
| |
22 |
end |
| |
23 |
end |
| |
24 |
|
| |
25 |
alias cucumber_puts puts |
| |
26 |
def puts(*a) |
| |
27 |
begin |
| |
28 |
cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a)) |
| |
29 |
rescue Iconv::IllegalSequence |
| |
30 |
cucumber_puts(*a) |
| |
31 |
end |
| |
32 |
end |
| |
33 |
end |
| |
34 |
end |
| |
35 |
end |