Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Need a Python script to convert a .txt from UTF to ANSI

If you have a question or need help, this is the place to be.
Post Reply
Septik
Posts: 39
Joined: Sun Feb 15, 2015 1:29 pm

Need a Python script to convert a .txt from UTF to ANSI

Post by Septik »

Hello there.
I use Eventghost, Tasker and Rainmeter to display information from my phone on my desktop, and vice-versa. In one of these desktop "widgets", I display information from a text file sent from my phone to EventGhost via AutoRemote. This text file is a log of things happening on my phone.

The problem then is that this text file is encoded in UTF (presumably UTF-8). This causes a problem for some lines containing a degree symbol (°). In the desktop widget, "°" becomes "°". This problem goes away if I manually resave the file using ANSI encoding. The updating of the text file in question is an event in itsself, so it's easy to have EventGhost respond to this. I now need a Python script that converts this file, encoding it in ANSI rather than UTF.

I've done some Googling and found that this should be possible, but I have no experience with Python and didn't manage to implement the suggestions I found online.

Any and all help highly appreciated.

Septik

EDIT: I figured out a solution that didn't involve the converting I thought necessary. I'll leave this thread anyways in case someone else needs a script like this without knowing they do. :)
Post Reply