scripting:encoding

Action unknown: addtobook

Scripting Text Encoding

Scripting functions in HippoEDIT (as internal functions of the editor) always operate with Unicode (UTF-16 LE). The original document encoding (code page) is only relevant during reading or saving of the document when external file data is converted into internal HippoEDIT data.

It is not possible to force scripting engine to use different code page rather than UTF-16.

But:

  • If you only want a document to be saved in specific code page and reloaded correctly, you can set initial document encoding (before any text manipulation) by using property Document::Encoding or even better by passing right encoding when creating a document.
  • If you want to convert text from one encoding to another, you can change Document::Encoding even after text manipulation, but in this case, you can get data loss. Because text will be converted from initial encoding to new one, and this can lead to losing of some symbols not existing in destination code page.
  • If you want actually do the conversion manually for some part of the text you can use wtoa method. But this is not recommended, while only needed if you work with actually binary data…