hyperbrew / bolt-cep

A lightning-fast boilerplate for building Adobe CEP Extensions in React, Vue, or Svelte built on Vite + TypeScript + Sass
MIT License
318 stars 40 forks source link

strings from CEP encoded in macroman #137

Closed oliv1008 closed 1 week ago

oliv1008 commented 1 week ago

Hello,

I've ran into a bug where every strings from the CEP seems to be encoded in macroman. You can easily reproduce it by initializing a skeleton project with a single hello world function that print a string with a special character. Ex : In src/jsx/ppro/ppro.ts

export const helloWorld = () => {
  alert("Hello from Premiere Pro. Accent : é");
};

In src/js/main/main.tsx

import { evalTS } from "../lib/utils/bolt";

const Main = () => {
  return (
    <div>
      <h1 style={{ color: "#ff5b3b" }}>Welcome to Bolt CEP!</h1>
      <button
        onClick={() => {
          evalTS("helloWorld");
        }}
      ></button>
    </div>
  );
};
export default Main;

A call to the function result in

image

This is not a display bug, as if I retrieve the name of let's say a projectItem that contains a special character and print it, it will be displayed correctly. It really is the content of the string (this is troublesome because I can't match it against other strings from ppro). This bug was not present in bolt-cep in July 2023

I'm am on MacOs with an M3 chip. Bug noted on premiere pro 24.6.3

EDIT :

Here what i meant by "matching against other strings from ppro" :

image

On the first line I'm logging the same string as before, written by me. On the second line I'm directly logging the name of the projectItem.

EDIT2:

Seems like I can fix the problem by explicitly specifying the unicode that I want, like so :

qe?.outputToConsole(`accent unicode : \u00E9`);
justintaylor-dev commented 1 week ago

This is related to ExtendScript encoding, not Bolt CEP. To fix, run $.appEncoding = "UTF-8"; before executing scripts with special characters