1# Features covered: international issues 
2#
3# Copyright (c) 2002 Rolf Ade.
4#
5# RCS: @(#) $Id: i18n.test,v 1.5 2002/11/16 01:31:37 rolf Exp $
6
7source [file join [file dir [info script]] loadtdom.tcl]
8
9test i18n-1.1 {parse utf-8 string} {need_i18n} {
10    set russian "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439"
11    set doc [dom parse "<test>$russian</test>"]
12    set root [$doc documentElement]
13    set text [$root text]
14    $doc delete
15    string compare $text "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439"
16} {0}
17
18test i18n-1.2 {parse utf-8 channel} {need_i18n} {
19    set fd [open [file join [pwd] [file dir [info script]] data/i18n_1.xml]]
20    fconfigure $fd -encoding utf-8
21    set doc [dom parse -channel $fd]
22    close $fd
23    set root [$doc documentElement]
24    set text [$root text]
25    $doc delete
26    string compare $text "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439"
27} {0}
28    
29test i18n-1.3 {parse utf-8 readFile} {need_i18n} {
30    set doc [dom parse [::tDOM::xmlReadFile [file join [pwd] [file dir [info script]] data/i18n_1.xml]]]
31    set root [$doc documentElement]
32    set text [$root text]
33    $doc delete
34    string compare $text "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439"
35} {0}
36    
37
38# cleanup
39::tcltest::cleanupTests
40return
41
42