I'm writing from pandas to csv like this:
df.to_csv(extractpath+'/extract_{}'.format(locname))
Now, when locname variable contains croatian characters, I get error
*UnicodeEncodeError: 'ascii' codec can't encode character '\u0161' in position 53: ordinal not in range(128)*
The only workaround I come up with is this:
df.to_csv(extractpath+'/extract_{}'.format(locname.encode('utf-8')))
However, although error is now gone, file names are not correct anymore, for example they look like:
*extract_b'Vara\xc5\xbedin'* instead of *extract_Varaždin*
How can I properly solve the problem?