Choose endianness for conversion#107
Open
aledeg wants to merge 1 commit intopsliwa:1.2.xfrom
aledeg:fix-bom
Open
Choose endianness for conversion#107aledeg wants to merge 1 commit intopsliwa:1.2.xfrom aledeg:fix-bom
aledeg wants to merge 1 commit intopsliwa:1.2.xfrom
aledeg:fix-bom
Conversation
According to that message on stackoverflow (http://stackoverflow.com/questions/8923866/convert-utf8-to-utf16-using-iconv#8924403), choosing which endianness we want to use remove the BOM from the string. The BOM was generated in the bookmarks text during the generation. When forcing the endianness, the BOM is no longer rendered. See #102
Owner
|
It looks like this PR breaks bookmarks feature at all (at least on my machines - I've tested this on php 5.3 and 5.5). Are you sure this is the solution? I am not able to reproduce the problem from #102 |
Contributor
Author
|
I was able to reproduce it on my machine. I am running PHP 7. <?php
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
set_time_limit(0);
require_once __DIR__.'/../vendor/autoload.php';
$facade = PHPPdf\Core\FacadeBuilder::create()->build();
$doc = <<<DOC
<pdf>
<dynamic-page>
<div bookmark="Hêtre">Hêtre</div>
<div bookmark="Où">Où</div>
<div bookmark="Trouvère">Trouvère</div>
<div bookmark="Étendu">Étendu</div>
</dynamic-page>
</pdf>
DOC;
$content = $facade->render($doc);
header('Content-Type: application/pdf');
echo $content;And to answer your question, I am really not sure about this being a solution. But it looks like the endianness of the string is the root of the problem. |
Contributor
Author
|
I tried again on PHP 5.5. I can reproduce with the code above and I can fix it with the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to that message on stackoverflow (http://stackoverflow.com/questions/8923866/convert-utf8-to-utf16-using-iconv#8924403), choosing which endianness we want to use remove the BOM from the string.
The BOM was generated in the bookmarks text during the generation. When forcing the endianness, the BOM is no longer rendered.
See #102