Try change TranslateTable:
Class dc.test [ Abstract ]
{
ClassMethod runtests()
{
;d ##class(dc.test).runtests()
s data="тест"
w "data: ",?15,data,!
s cs=##class(%Stream.FileCharacter).%New(),
cs.Filename="C:\Temp\test.txt",
cs.TranslateTable="UTF8"
d cs.Write(data),
cs.%Save()
s bstream=##class(%Stream.FileBinary).%New()
d bstream.LinkToFile(cs.Filename)
w "Binary:",?15,$system.Encryption.Base64Encode($system.Encryption.SHAHashStream(256,bstream)),!
s cstream=##class(%Stream.FileCharacter).%New()
d cstream.LinkToFile(cs.Filename)
w "Char:",?15,$system.Encryption.Base64Encode($system.Encryption.SHAHashStream(256,cstream)),!!
s cstream.TranslateTable="" ;or RAW, SAME
w "Char->Binary:",?15,$system.Encryption.Base64Encode($system.Encryption.SHAHashStream(256,cstream))
}
}
USER>d ##class(dc.test).runtests()
data: тест
Binary: 409t7BLE9FmeugePMa6BOUINIbG9LXztfSKwnCB0+0g=
Char: 2eEII+27ZRfvbZvK4XNsx7WPDb+82DymPPOAdJ0p1SQ=
Char->Binary: 409t7BLE9FmeugePMa6BOUINIbG9LXztfSKwnCB0+0g=- Log in to post comments