]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
tcl_tests: Make utf-8 encoding work
authorVitaly Chikunov <vt@altlinux.org>
Sun, 10 Nov 2019 01:34:01 +0000 (04:34 +0300)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Sat, 11 Jan 2020 21:20:37 +0000 (00:20 +0300)
- Remove emacs coding: cp1251 tag
- Change stats file encoding to utf-8
- Change packages source to have -encoding utf-8
- Run tclsh with -encoding utf-8
- Make `proc rus' noop.

This will make Tcl automatically translate scripts output from utf-8 to
system encoding.

37 files changed:
tcl_tests/ca.try
tcl_tests/calchash.tcl
tcl_tests/calcstat
tcl_tests/client.try
tcl_tests/cms.try
tcl_tests/cms2.try
tcl_tests/cms_cs.try
tcl_tests/cms_io.try
tcl_tests/cmsenc.try
tcl_tests/cmsenc_cs.try
tcl_tests/cmsenc_io.try
tcl_tests/cmsenc_sc.try
tcl_tests/dgst.try
tcl_tests/enc.try
tcl_tests/engine.try
tcl_tests/http.tcl
tcl_tests/hwkeys.tcl
tcl_tests/mac.try
tcl_tests/make_other.sh
tcl_tests/nopath.try
tcl_tests/ocsp.try
tcl_tests/pkcs12.try
tcl_tests/pkgIndex.tcl
tcl_tests/req-genpkey.try
tcl_tests/req-newkey.try
tcl_tests/runtest.sh
tcl_tests/server.try
tcl_tests/smime.try
tcl_tests/smime2.try
tcl_tests/smime_cs.try
tcl_tests/smime_io.try
tcl_tests/smimeenc.try
tcl_tests/smimeenc_io.try
tcl_tests/ssl.try
tcl_tests/test.tcl
tcl_tests/ts.try
tcl_tests/wcli.try

index c84088cebb75ec5d2d2c4a7fee4b3b92b500b61c..6d76283a22888c99198f78bdecd55f2d7c20e246 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index ec68961e9fc3de41018ae788daa8271e983b2ad6..b943bef98c346f9a0742a7e3243b2808e0066cde 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require test
 
index 3e59eb60b8ed43db91f5ed87bda9af94e9616e9f..c2a19da7a5a410111031a480838fa6ce7d03aa6b 100644 (file)
@@ -4,7 +4,7 @@ if {$tcl_platform(platform) == "unix"} {
 }
 lappend auto_path [file dirname [info script]] 
 proc rus {string} {
-       return [encoding convertfrom cp1251 [encoding convertto $string]]
+       return $string
 }
 proc compare_order {el1 el2} {
        global order
@@ -13,7 +13,7 @@ proc compare_order {el1 el2} {
 set statsfile stats
 if {$argc} {set statsfile [lindex $argv 0]}
 set f [open $statsfile]
-fconfigure $f -encoding cp1251
+fconfigure $f -encoding utf-8
 set ordno 0
 while {[gets $f line] >=0} {
        set script [lindex $line 0]
@@ -34,7 +34,7 @@ proc output {line} {
 
 if {$argc > 1} {
        set out [open [lindex $argv 1] w]
-       fconfigure $out -encoding cp1251
+       fconfigure $out -encoding utf-8
 }      
 
 output [format "%-12s %-41s%5s %4s %4s %4s %4s"  File "Test name" Total ok fail skip ign]  
index d6abcb35b5baf782e49fb7f130c6a8ed68ec48b2..2658ce64fc07da85c33feb7fb1df8d30fd0b757d 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 
 package require ossltest
index 476da0defd7bb2d24dca50c5cca5fedf9339d9af..2db2958a7105a5d92829577f5809ba3a45ec5ae8 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 1233d55980d76caed1712321ca0ace297048e3fa..884f1eca6db0c6a4f23dd5612cd4c3f0f1aa10bf 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index d246fe83f2a2472bd11bff5b04d757bd9230f0a8..2a619b2d843158fa7523ee9388edba80edf1aa26 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 92c3619f27f557b4c74f4a1b078523a598b5d158..0283419c96add39785a99fdc69ce41db39308dce 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 66082265dbfce5f546488e71cd7d518e6acb6999..3203765469468e4043941595be1bf6e8e1081ee8 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 3ae497e301b247621bc7fe1bd1ab4340c3af7212..10cb08a9f76588bc0f253c0cc7e30c3c5eb98b82 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 package require test
index a78e11321f3f0dda91fcfacb21597139c61a27d0..01eac8a59df642218d9e624e0a7c9882202e7ece 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index dbd4c2b9a5bc919c6a9268671a9bdc91fb14d208..ab489d0737d9231276e0ca6bc77437e623f0ee98 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 package require test
index 148e1d6154a4a813d61dfbcf44f9509096da7c1f..21c2ca7fd29a8fe3377809b8dd7fc214bd01da3e 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 2f682a77fb3cb6fd092a027459f8d2a9aa57f9a2..1398d13ef33b81ae7cd7fc848f6a5565fbdfe48f 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh/
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]] 
 package require ossltest
 set plain0 [getFile plain.enc]
index 2090e59b11a9f5aa915f53de90ec36c1e9f36deb..347cc313047c1fa23f62a285595205a0185ea648 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir 
index 61216174a57734c934b1180ecd6d7095ed3f09b0..37277b90ceac70af75731d643bbcaca09e361688 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: cp1251 -*-
 # 
 # Получает в командной строке URL и (опционально) строку для поиска
 # сертификата. Выполняет HTTP-запрос и возрвщает результат
index 8c86a82201b7cb3f49fa78d600529199fe4ab945..85432137ca51a086874384259cc7fddb9bb36519 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: cp1251 -*-
 package require testlib
 
 start_tests "Работа с аппаратными носителями"
index de2cb6b9f45b829fc36e5e20e19f7e8c2acd3fd6..9b261e8e93f8319204ffca71b5596bb5e8fa7289 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index ed9d9e86eb3419264813ea9b875d642363a3fa14..ea8ad85ac28e9d4473f397767fe6f2d4b3625ca2 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/sh
-# -*- coding: cp1251 -*-
 
 # Создает подкаталог OtherVersion, копирует в него данные для тестирования
 # совместимости с другими версиями.
index c3664ae5f1fd764c8e2c955de2c13f03f47da3a5..d78a14de273387cc9c7b5e58b5dbf9889bec9cb7 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 30c1218bf80c4731bf69a37742e364c63accafc3..a1b2c68497e815b9e91da935e38c239503b66a7d 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir 
index 52e23d6d774db11c7dac0e6c8eec0531466a8cbe..6fc7ecb3aed532baf61b6286a1d4a98425d49ccd 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index f4a33454fdeb395d6f34fc7c8b80c4a463cc2639..cb3f9d44bb0d0c7cd85a5f59939d1b60d82a5cde 100644 (file)
@@ -1,6 +1,6 @@
-package ifneeded test 0.2 [list source [file join $dir test.tcl]]
-package ifneeded testlib 0.1 [list source [file join $dir testlib.tcl]]
-package ifneeded fgetopt 0.1 [list source [file join $dir fgetopt.tcl]]
-package ifneeded asn 0.7.1 [list source [file join $dir asn.tcl]]
-package ifneeded base64 2.3.2 [list source [file join $dir base64.tcl]]
-package ifneeded ossltest 0.7 [list source [file join $dir ossltest.tcl]]
+package ifneeded test 0.2 [list source -encoding utf-8 [file join $dir test.tcl]]
+package ifneeded testlib 0.1 [list source -encoding utf-8 [file join $dir testlib.tcl]]
+package ifneeded fgetopt 0.1 [list source -encoding utf-8 [file join $dir fgetopt.tcl]]
+package ifneeded asn 0.7.1 [list source -encoding utf-8 [file join $dir asn.tcl]]
+package ifneeded base64 2.3.2 [list source -encoding utf-8 [file join $dir base64.tcl]]
+package ifneeded ossltest 0.7 [list source -encoding utf-8 [file join $dir ossltest.tcl]]
index e333dc0d2432ecae76c50e6831d59d580e861931..a368ced2991c8b2029fcb5c390698f35317cd706 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 # создание секретного ключа
 # создание заявки и самоподписанного сертификата командой req
 # проверка OIDов алгоритма во всех структурах
index fe05fa698c0958eb4a31b14f8799492325a10fe1..3c4a8a80141a219d4be56c994c3367cb852a0656 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 if {[info exists env(PKG_PATH)]} {
        lappend auto_path $env(PKG_PATH)
 } else {       
index a59c9461cb7abef42598eca349d3d74ee51c9b5e..11fdedad284b14a88fdb233b41dd4de68308da0d 100644 (file)
@@ -1,5 +1,4 @@
 #!/bin/sh
-# -*- coding: cp1251 -*-
 
 # Состав набора тестов
 # 1. Этот скрипт
@@ -65,6 +64,7 @@ if [ -z "$TCLSH" ]; then
 else
        echo "Using $TCLSH as tclsh"
 fi
+TCLSH="$TCLSH -encoding utf-8"
 
 APP_SUFFIX=`basename $OPENSSL_APP .exe|sed s/openssl//`
 [ -n "$OPENSSL_APP" ]&& export OPENSSL_APP
index bc126385ff47f1be3e2440c4011eeae73b5f16c4..5c4048ae5ef08c93ddcee43f99961fb34133665c 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 
 
index cd610ba1e39e1c05f5ec2c3bc6400a7b4a22ae06..3fd722a2307980976a2d9973c75a22182076836b 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index c3bdd129f7a54e14eae6d12b374f66b64b0839fc..071ad85909af7d83f6b03129e7ea04e020951215 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 1a0145162c0d738e22d291792640a7bae7079c7f..3792bc4c72787c35290a30f66b79aa9731628752 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index ec4df2dcbb446d72b1ba405a0e5b28daea748df4..daf76b275cf99062dafe06c7c42f3c88dc94432d 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index ea8be822789fac7d2166a85a89f5e38b19cc441e..0f341bfc71b3ec097b9eead8b542fd922146c069 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index fa991cefbc28586dba577715f7afeb47dd249622..0c17b8edef2c05ba8724ac4086ef349fe188cab8 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 54672bc6b439eb8c36346712c98572f47256727b..16f61d1517e50d9399de93f208e48b23620b01b7 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
+
 lappend auto_path [file dirname [info script]]
 package require ossltest
 if {$argc==2} {
index 8e2b45a7556b7f4e6c233b6aa4adae952ad6ed1d..cf7c2b7121cc56e6bcf3ef2cb481aa666097a8e1 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: cp1251 -*-
 # Установка номера тестового ПРА
 
 namespace eval vizir {
@@ -109,7 +108,7 @@ namespace eval test {
                } 
                set test_id [file rootname [file tail [info script]]]$suffix
                set stat [open "stats" a]
-               fconfigure $stat -encoding cp1251
+               fconfigure $stat -encoding utf-8
                puts $stat [list $test_id [rus $t_name] $no $ok $failed $p_skip $c_skip] 
                close $stat
                if {!$failed} { 
@@ -263,21 +262,8 @@ proc listcompare {list1 list2 time} {
        }       
        return 1
 }
-# Перекодирует строку из кодировки скрипта (assumed 1251)
-# в текущую системную
-
-if {[encoding system] == "utf-8" } {
-
 proc rus {string} {
-       return [encoding convertfrom cp1251 $string]
-}
-
-} else {
-
-proc rus {string} "
-       return \[encoding convertfrom cp1251 \[encoding convertto [encoding system] \$string\]\]
-"
-
+       return $string
 }
    #
    # Пишет строку в лог
index fe8fa04b089062fc3aa2bb8126daccf859c95c85..e3a4bade6ba1e21de5ad040ddfa9e5b047b842bf 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest
 cd $::test::dir
index 35ed5780fea719e1821fd3327002a3acf5f1af26..230ee8ee283786e5ea68768a4a91c1d7b6742295 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/tclsh
-# -*- coding: cp1251 -*-
 lappend auto_path [file dirname [info script]]
 package require ossltest