Csv header encoding problem

OS: win10 Chinese edition, default encoding is GBK (codepage 936)
version: 8.0.16, Maker’s edition

If there is chinese character in tag path, when I export historial dataset to csv file, the header contains unidentified characters.


## convert tag path to name
names = [re.sub(string_before_tag_path,'',p).decode() for p in hist_tag_list]

# default is CST UTC+8
start_datetime = system.date.parse('2020-12-18 14:30:00', 'yyyy-MM-dd HH:mm:ss')
end_datetime = system.date.parse('2020-12-18 15:45:00', 'yyyy-MM-dd HH:mm:ss')
print 'start at: ', start_datetime
print 'end at: ', end_datetime

data = system.tag.queryTagHistory(paths=hist_tag_list, columnNames=names,
startDate=start_datetime, endDate=end_datetime, returnSize=100, aggregationMode="Average", returnFormat='Wide')

# Turn that history data into a CSV.
csv = system.dataset.toCSV(dataset = data, showHeaders = True, forExport = False,localized = False)
# Export that CSV to a specific file path. The r forces it to use the raw path and not require double backslashes.
system.file.writeFile(r"C:\workspace\n2o\myExport.csv", csv)

Currently, my solution is pass columnNames to system.tag.queryTagHistory(). And the columnNames are passed as decoded unicode strings. Then open the generated myExport.csv file using GBK encoding.