-----------------------------------------------------------
REQUEST HB_CODEPAGE_RU1251
REQUEST HB_CODEPAGE_RU866
Function Main ()
local cMsg866, cMsg1251,mtest1251:="1234567890",mtest866:="1234567890",i
clear
cMsg866 := '�ਢ�� 866...' //привет 866
cMsg1251 := '������ 1251' //привет 1251
REQUEST HB_CODEPAGE_RU866
Function Main ()
local cMsg866, cMsg1251,mtest1251:="1234567890",mtest866:="1234567890",i
clear
cMsg866 := '�ਢ�� 866...' //привет 866
cMsg1251 := '������ 1251' //привет 1251
// тут про яркий синий воздушный шарик
arr866:={"�ન�", "�����", "���������", "��ਪ", "�ન�", "ᨭ��", "���������", "��ਪ"}
arr1251:={"�����", "�����", "���������", "�����", "�����", "�����", "���������", "�����"}
? '=====111================'
hb_setTermCP("RU866","RU866")
? 'HB_CDPSELECT( "RU866" )'
? cMsg866
? cMsg1251
hb_setTermCP("RU1251","RU1251")
? 'HB_CDPSELECT( "RUWIN" )'
? cMsg866
? cMsg1251
hb_setTermCP("","") // reset codepage to default value
? "=====222====================="
HB_CDPSELECT( "RU1251" )
?
?"CDPSELECT initial 1251:"
for each i in arr1251
? " ", i
end
?"CDPSELECT sorted:"
asort (arr1251)
for each i in arr1251
? " ",i
end
HB_CDPSELECT( "RU866" )
?
?"CDPSELECT initial 866:"
for each i in arr866
? " ",i
end
?"CDPSELECT sorted:"
asort (arr866)
for each i in arr866
? " ",i
end
? "=====333====================="
hb_setTermCP("RU1251","RU1251")
?
?"termcp initial 1251:"
for each i in arr1251
? " ", i
end
?"termcp sorted:"
asort (arr1251)
for each i in arr1251
? " ",i
end
hb_setTermCP("RU866","RU866")
?
?"termcp initial 866:"
for each i in arr866
? " ",i
end
?"termcp sorted:"
asort (arr866)
for each i in arr866
? " ",i
end
? "=====444====================="
dbCreate( "Nakl1.dbf", { {"f1251","C",10,0},{"f866","C",10,0} } )
hb_setTermCP("RU1251","RU1251")
@ 10,10 say "enter test" get mtest1251
read
? mtest1251
hb_setTermCP("RU866","RU866")
@ 10,10 say "enter test" get mtest866
read
? mtest866
use "Nakl1.dbf" new
Append blank
1->f1251:= mtest1251
1->f866:=mtest866
close all
Return Nil
? '=====111================'
hb_setTermCP("RU866","RU866")
? 'HB_CDPSELECT( "RU866" )'
? cMsg866
? cMsg1251
hb_setTermCP("RU1251","RU1251")
? 'HB_CDPSELECT( "RUWIN" )'
? cMsg866
? cMsg1251
hb_setTermCP("","") // reset codepage to default value
? "=====222====================="
HB_CDPSELECT( "RU1251" )
?
?"CDPSELECT initial 1251:"
for each i in arr1251
? " ", i
end
?"CDPSELECT sorted:"
asort (arr1251)
for each i in arr1251
? " ",i
end
HB_CDPSELECT( "RU866" )
?
?"CDPSELECT initial 866:"
for each i in arr866
? " ",i
end
?"CDPSELECT sorted:"
asort (arr866)
for each i in arr866
? " ",i
end
? "=====333====================="
hb_setTermCP("RU1251","RU1251")
?
?"termcp initial 1251:"
for each i in arr1251
? " ", i
end
?"termcp sorted:"
asort (arr1251)
for each i in arr1251
? " ",i
end
hb_setTermCP("RU866","RU866")
?
?"termcp initial 866:"
for each i in arr866
? " ",i
end
?"termcp sorted:"
asort (arr866)
for each i in arr866
? " ",i
end
? "=====444====================="
dbCreate( "Nakl1.dbf", { {"f1251","C",10,0},{"f866","C",10,0} } )
hb_setTermCP("RU1251","RU1251")
@ 10,10 say "enter test" get mtest1251
read
? mtest1251
hb_setTermCP("RU866","RU866")
@ 10,10 say "enter test" get mtest866
read
? mtest866
use "Nakl1.dbf" new
Append blank
1->f1251:= mtest1251
1->f866:=mtest866
close all
Return Nil
-----------------------------------------------
Ну с кодом , наверное, все понятно. сначала демонстрация hb_setTermCP("ККК","ККК"), потом HB_CDPSELECT( "RU1251" ), потом ввод с клавиатуры, запись в БД в разных кодировках. Результат обнадеживает! данные записались в нужных кодировках. Теперь нужно бы проверить как поведет себя база с индексами, но это как нибудь потом. После проверки этого кода на винде.
-----------------------------------------------
проверил на wine - нормально видно только кодировку 1251, в которой , собственно он, wine, и работает.
Комментариев нет:
Отправить комментарий