henck / henck/rtf-html-php

Bad conversion in this case

Open
#76 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
107
Forks
79
PR merge metrics
No merged PRs in 30d

Description

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,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied PHP reproduction, tracing Document and HtmlFormatter as the RTF is parsed and formatted. The fix is done when the example produces the expected “Mélange maïs français” text without RTF control-word artifacts; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.