Giter Club home page Giter Club logo

Comments (3)

lilliputten avatar lilliputten commented on August 24, 2024 1

Hi! Sorry, I don't have enough time to try to take a look at this problem. Probably, I'll try to look one of these days.

And one more thing: I haven't touched this project for several years. I think it'll take me some time to remember how all those thing works there.

from jsrtf.

Gennady-G avatar Gennady-G commented on August 24, 2024

Than You @lilliputten !

Only if You have free time. Think my question is not related with Your encoding function and Your project, looks like it is working Ok - I get result as "Abc Ø àáâ" (russian-letters are encoded ok here, and this symbol exists on this step)..

But I possibly loose this 'Ø' when convert to binary data in this string:

let buf = Buffer.from(inputText, "ascii");

Other Buffer encoding options give wrong results too.. Have no clue how to fix it oO

from jsrtf.

Gennady-G avatar Gennady-G commented on August 24, 2024

Hi Igor!

So I finally resolved this after few days :-D

There was mashup of encodings in "Abc Ø абв" and I can't convert the whole text in Win-1251 or Win-1252.

shaa-2023-09-29_225122

Because Win-1251 does not contain "Ø" and Win-1251 does not contain "абв"..

I didn't want to insert unicode, but the only way I see is to convert all text with such symbols as \u1234?. So created this function:

function unicode_to_rtf_representation_u(srcStr) {
  if (srcStr == undefined) return "";

  let tgtStr = "";

  for (var i = 0; i < srcStr.length; i++) {
    let c = srcStr.charCodeAt(i);
    let result = "\\u" + c + "?";

    tgtStr += result; 
  }
  console.log("result strings is: " + tgtStr);
  return tgtStr;
}

it does something like

Abc Ø абв --> \u65?\u98?\u99?\u32?\u216?\u32?\u1072?\u1073?\u1074?

and this works..

from jsrtf.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.