1

In the praat preferences menu it is possible to change the encoding of files written by Praat by using

Praat > Preferences > Text writing preferences...

My question whether it is possible to do this from within the script to guarantee that the user is always saving files with the correct encoding;

In my case UTF-8 w/o BOM. The default is try ASCII then UTF-16 which inserts the two bytes (BOM style) in the header of the file.

badner
  • 768
  • 2
  • 10
  • 31
  • 2
    Be careful when changing the user preferences for a specific script, however. You should at least make sure the user know that this is happening, because if they've specifically set the preferences to something else, you shouldn't go changing things for them. One way to sidestep this problem is by saving the original value of the preferences, and then restoring after you are done. The `serialise` plugin has [an example of this approach](https://gitlab.com/cpran/plugin_serialise/blob/master/procedures/preferences.proc). – jja Jun 29 '17 at 19:56

1 Answers1

3

Simply put

Text writing preferences: "UTF-8"

at the beginning of your script.

Stefano
  • 1,405
  • 11
  • 21