FileSystemObject - Reading Unicode Files

前端 未结 5 1801
闹比i
闹比i 2021-01-04 09:52

Classic ASP, VBScript context.

A lot of articles including this Microsoft one, say you cannot use FileSystemObject to read Unicode files.

I

5条回答
  •  一个人的身影
    2021-01-04 10:12

    'assume we have detected that it is Unicode file - then very straightforward 
    'byte-by-byte crawling sorted out my problem:
    '.
    '.
    '.
    else
       eilute=f.ReadAll
       'response.write("ČIA BUVO ČARLIS
    ") 'response.write(len(eilute)) 'response.write("
    ") elt="" smbl="" for i=3 to len(eilute) 'First 2 bytes are 255 and 254 baitas=asc(mid(eilute,i,1)) if (i+1) <= len(eilute) then i=i+1 else exit for end if antras=asc(mid(eilute,i,1))*256 ' raidems uzteks 'response.write(baitas) 'response.write(asc(mid(eilute,i,1))) 'response.write("
    ") if baitas=13 and antras=0 then 'LineFeed response.write(elt) response.write("
    ") elt="" if (i+2) <= len(eilute) then i=i+2 'persokam per CarriageReturn else skaicius=antras+baitas smbl="&#" & skaicius & ";" elt=elt & smbl end if next if elt<>"" then response.write(elt) response.write("
    ") elt="" end if end if f.Close '. '.

提交回复
热议问题