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

Don't break encoding of non-ISO-8859-1 data #12

Merged
merged 6 commits into from
May 24, 2018
Merged

Don't break encoding of non-ISO-8859-1 data #12

merged 6 commits into from
May 24, 2018

Conversation

manicki
Copy link
Member

@manicki manicki commented May 24, 2018

$entityLoaderDisabled = libxml_disable_entity_loader( true );
$internalErrors = libxml_use_internal_errors( true );
$document = new DOMDocument();
$document = new DOMDocument( null, 'UTF-8' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probalbly version "1.0" is the righter thing™ to do, albeit the outcome will be the same.

]
}
</script>
<div id="result">
<!-- generated by `npm run-script populate-fixtures` -->
<div class="lemma-widget"><ul class="lemma-widget_lemma-list"><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">lemma1</span> <span class="lemma-widget_lemma-language">en</span></li><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">lemma2</span> <span class="lemma-widget_lemma-language">fr</span></li></ul> <div class="lemma-widget_controls"><button type="button" class="lemma-widget_control">wikibase-edit</button> <!----> <!----></div></div>
<div class="lemma-widget"><ul class="lemma-widget_lemma-list"><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">lemma1</span> <span class="lemma-widget_lemma-language">en</span></li><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">l&#xE9;mma2</span> <span class="lemma-widget_lemma-language">fr</span></li><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">&#xAE30;&#xBCF8;&#xD615;</span> <span class="lemma-widget_lemma-language">ko</span></li><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">&#x41B;&#x435;&#x43C;&#x43C;&#x430;</span> <span class="lemma-widget_lemma-language">ru</span></li><li class="lemma-widget_lemma"><span class="lemma-widget_lemma-value">&#x644;&#x644;&#x64A;&#x645;&#x627;</span> <span class="lemma-widget_lemma-language">ar</span></li></ul> <div class="lemma-widget_controls"><button type="button" class="lemma-widget_control">wikibase-edit</button> <!----> <!----></div></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is really the outcome of npm run-script populate-fixtures - and it contains html entities for characters that, in an UTF-8 world could be expressed without html entities. In the clients we do not want this to happen (right?!) so why do we have a test proving the opposite?

[ 'value' => '<p>한국어</p>' ]
);

assertThat( $result, is( equalTo( '<div><div><p>한국어</p></div></div>' ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite to the point of this bug, but we talked about is earlier... if v-html="value" is not part of the rendered mark-up there is no way for client-side JS code to find the respective node for data binding. So what is really the benefit of having both mustache and the v-html way of interpolating variables?

As Vue rendering does not do it either. Makes for more clear
expectations from the PHP renderer.
Copy link
Contributor

@wiese wiese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to walk this through!

@wiese wiese merged commit e962820 into master May 24, 2018
@wiese wiese deleted the encoding branch May 24, 2018 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants