• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is it possible to read a UTF-16 encoded file text file using cep.fs.readFile?

Engaged ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Hi All

I'm on a Mac, trying to read a UTF-16 encoded xml/text file from my HTML5 extension panel in Premiere Pro CC2017.

My javascript statement, result = window.cep.fs.readFile(myFilePath);  returns without error, but result.data is empty.

If I open the target file in a text editor application (e.g. TextEdit) and resave it with UTF-8 encoding then everything works fine.

Is there any alternative to window.cep.fs.readFile that I can use from my HTML5 extension panel that would allow me to successfully read/convert a UTF-16 encoded file?

Many thanks in advance

Andy

TOPICS
SDK

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Jan 06, 2017 Jan 06, 2017

I think readFile can do it; see this blog page about specifying a decode method:

Adobe CEP APIs | Adobe Developer Connection

Also useful: CEP HTML Test Extension uses readFile:

Samples/NativeFunction.html at master · Adobe-CEP/Samples · GitHub

Votes

Translate

Translate
Adobe Employee ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

I think readFile can do it; see this blog page about specifying a decode method:

Adobe CEP APIs | Adobe Developer Connection

Also useful: CEP HTML Test Extension uses readFile:

Samples/NativeFunction.html at master · Adobe-CEP/Samples · GitHub

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Hey Bruce

Thanks for the quick reply. Yes, that is the sample code I'm working from ... I thought perhaps that it was my implementation of the code but it doesn't even work for me when directly using the 'CEP HTML Test Extension' either.

As a test, please try this yourself if you have the time:

1) Open a Premiere Pro project

2) Create a new Title element

3) Select the Title element in the project window and export it (File > Export) as a Title (.prtl) file.

4) Open the CEP HTML Test Extension and select the Native Functions tab

5) Use File APIs > File Open Dialog to get the path of the Title (.prtl) file you just exported.

6) Use File APIs > Read File with the path to your Title (.prtl) file to read the data

Is the text of your Title (.prtl) file displayed? It's not working here on my iMac ... didn't occur to me that it might be specific to my system/install, but if so, it would certainly explain why I'm having so much trouble with my code!

Thanks

Andy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Thanks again for your pointers Bruce.

Didn't manage to get readFile to work but have implemented a FileReader method instead which seems to be working just fine.

Cheers

Andy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

LATEST

Hi Andy,
4 years later we are having the same problem. Premiere Pro exports its markers in UTF-16LE but cannot read that file with window.cep.fs.readFile() on a Mac.

 

How did you solve the problem in your FileReader method?

Thanks,
Tyron

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines