dockfries / infernus

Node.js library for scripting Open Multiplayer.
https://dockfries.github.io/infernus/
MIT License
21 stars 2 forks source link

UTF-8 Character Encoding Issue #28

Closed cha5e369 closed 1 year ago

cha5e369 commented 1 year ago

Currently, I’m encountering an issue related to character encoding while compiling the library. It should be able to handle strings containing Hispanic characters (áéíóúñ) with accents or accented characters when using UTF-8, but it seems that this isn’t being achieved correctly.

The workspace encoding within the IDE is set to UTF-8.

Example code:

import { playerEvent } from "@/controller/player";
import { logger } from "@/logger";
import { MyDialog } from "@/models/dialog";
import { DialogStylesEnum, IDialog } from "@infernus/core";

playerEvent.onCommandText("test", async (player, ...args) => {

  const StringData = `
  Normal characters: aeiou.
  Hispanic characters: áéíóú.
  `;

  const DialogData: IDialog = {
    style: DialogStylesEnum.MSGBOX,
    caption: "Charset issue",
    info: StringData,
    button1: "Close"
  };

  const res = await new MyDialog(DialogData).show(player);

  logger.info(res);

  return true;
});

0EC93C57-4E5D-4549-B89D-B9460E37719D

dockfries commented 1 year ago

Try to set the player's character set to "ISO-8859-1".

cha5e369 commented 1 year ago

Try to set the player's character set to "ISO-8859-1".

thanks u!