-config "C:\Program Files\SASHome\SASFoundation\9.4\nls\zh\sasv9.cfg"
from IPython.display import HTML
import saspy
sasz = saspy.SASsession(cfgname='winlocal', encoding='gb2312')
sasz
cars = sasz.sasdata('cars', 'sashelp', results='html')
sasz.batch=True
x = cars.head()['LST']
sasz.batch=False
len(x.encode())
print(x[:256])
fd = open(r'C:\Users\sastpw\AppData\Local\Temp\SAS Temporary Files\_TD4288_d10a626_\sashtml.htm', 'rb')
bin1 = fd.read()
fd.close()
len(bin1)
print(bin1[:256].decode())
bin1.decode()
bin1[41560:41600]
bin1[41560:41600].decode()
bin1[41560:41600].decode(errors='replace')
bin1[41560:41600].decode('gb2312')
#HTML(bin1.decode('gb2312'))
char1 = bin1.decode('gb2312')
char1 = char1.replace(chr(12), chr(10)).replace('<body class="c body">',
'<body class="l body">').replace("font-size: x-small;",
"font-size: normal;")
HTML(char1)
cars.head()