This commit is contained in:
Kolan Sh 2011-08-30 16:49:49 +04:00
parent 56d38274e9
commit 84a9feb735
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# -*- coding: cp1251 -*-
for i in range(0,256):
c=unicode(chr(i),"koi8-r")
c.encode("UTF-8")
for i in range(0,128):
print i," "

19
python/unicode.py Normal file
View File

@ -0,0 +1,19 @@
declare
@ucs nvarchar(4000),
@utf varchar(8000),
@w varbinary(2),
@i int
set @ucs = N'яфя Åk Paço عوديهالشرموطةناناالشرموطةفاطمةالشرموطةليلىالسحاقيةهالة'
set @utf = ''
set @i = 1
while @i <= len(@ucs)
begin
set @w = (select utf8 from ucs2utf8 where ucs2 = unicode(substring(@ucs, @i, 1)))
if @w/256 != 0 set @utf = @utf + char(@w/256)
if @w-(@w/256)*256 != 0 set @utf = @utf + char(@w-(@w/256)*256)
set @i = @i + 1
end
print @utf