pythonmojibakeftfy

Running simple script meant to fix Mojibake with Python and ftfy gives "*** Remote Interpreter Reinitialized ***"


When I run it nothing happens except "*** Remote Interpreter Reinitialized ***".

# https://junschoi.github.io/posts/ftfy_guide/
import ftfy

def main():  # Added by pyscripter.
    pass

ftfy.fix_text('This text should be in “quotesâ€\x9d.')  # Copied from the web page.

if __name__ == '__main__':  # Added by pyscripter
    main()

Solution

  • First, I would recommend the reading of Python PEPs. It will help you with Python sintaxes and best practices on the language! Also, try to better post your question!

    So, editing a little bit your code, I would suggest to do so:

    import ftfy
    
    def main():
        print_quotes = ftfy.fix_text('This text should be in “quotesâ€\x9d.')
        print(print_quotes)
    
    if __name__ == '__main__':
        main()
    

    I just execute the edited code above, and got 'This text should be in "quotes".' as output. So, probably you can go on from this.