Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad conversion in this case #76

Open
Max84 opened this issue Aug 21, 2020 · 1 comment
Open

Bad conversion in this case #76

Max84 opened this issue Aug 21, 2020 · 1 comment

Comments

@Max84
Copy link

Max84 commented Aug 21, 2020

RTF Translation is wrong in this case:

`<?php
error_reporting(-1);
ini_set('display_errors', 'on');
require DIR . '/vendor/autoload.php';

use RtfHtmlPhp\Document;
use RtfHtmlPhp\Html\HtmlFormatter;

$original = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\lang1036\f0\fs16 m'e9lange ma'efs fran'e7ais\par}";
$document = new Document($original); // or use a string directly
$formatter = new HtmlFormatter('UTF-8');
$r = $formatter->Format($document);
file_put_contents('rtf.html', $r);
echo $r;
?>`

Result:

tf1 onttbl 0 nil charset0 Microsoft Sans Serif;�iewkind4 0 s16 mélange maïs français

Expected result:
Something like "Mélange maïs français"

Thanks,

@alecpl
Copy link

alecpl commented Jul 8, 2021

Don't use double quotes for $original or replace every \ with \\.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants