Skip to content

Commit

Permalink
fix: strip zero width in xlf
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Oct 7, 2024
1 parent 9b9c08e commit e82460d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions EMS/xliff/src/Xliff/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public function addSimpleField(\DOMElement $document, string $fieldPath, string

public function addHtmlField(\DOMElement $document, string $fieldPath, ?string $sourceHtml, ?string $targetHtml = null, ?string $baselineHtml = null, bool $isFinal = false): void
{
$sourceCrawler = new Crawler(HtmlHelper::prettyPrint($sourceHtml));
$targetCrawler = new Crawler(HtmlHelper::prettyPrint($targetHtml));
$baselineCrawler = new Crawler(HtmlHelper::prettyPrint($baselineHtml));
$sourceCrawler = new Crawler(HtmlHelper::prettyPrint(HtmlHelper::stripZeroWidthCharacters($sourceHtml)));
$targetCrawler = new Crawler(HtmlHelper::prettyPrint(HtmlHelper::stripZeroWidthCharacters($targetHtml)));
$baselineCrawler = new Crawler(HtmlHelper::prettyPrint(HtmlHelper::stripZeroWidthCharacters($baselineHtml)));
$added = false;
$group = new \DOMElement('group');
$document->appendChild($group);
Expand Down
4 changes: 2 additions & 2 deletions EMS/xliff/src/Xliff/InsertionRevision.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ private function importField(InsertReport $insertReport, \DOMElement $segment, s
$expectedSourceValue = $propertyAccessor->getValue($extractedRawData, $sourcePropertyPath);

if ('html' === $format) {
$expectedSourceValue = HtmlHelper::prettyPrint($expectedSourceValue);
$sourceValue = HtmlHelper::prettyPrint($sourceValue);
$expectedSourceValue = HtmlHelper::prettyPrint(HtmlHelper::stripZeroWidthCharacters($expectedSourceValue));
$sourceValue = HtmlHelper::prettyPrint(HtmlHelper::stripZeroWidthCharacters($sourceValue));
} elseif (null !== $format) {
throw new \RuntimeException(\sprintf('Unexpected %s field format', $format));
}
Expand Down

0 comments on commit e82460d

Please sign in to comment.