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

Content fails at ampersand(&) symbol #873

Closed
Joel-James opened this issue Aug 26, 2016 · 4 comments
Closed

Content fails at ampersand(&) symbol #873

Joel-James opened this issue Aug 26, 2016 · 4 comments

Comments

@Joel-James
Copy link

Joel-James commented Aug 26, 2016

PHPWord fails to render content following & symbol. Any idea how to resolve this?
#401

@Joel-James
Copy link
Author

Resolved by using htmlspecialchars()

@likeuntomurphy
Copy link
Contributor

Check out http://phpword.readthedocs.io/en/latest/general.html#output-escaping — automatic output escaping was added in 0.13.0, but you need to opt in.

@tfak
Copy link

tfak commented Jul 4, 2019

Output escaping
Writing documents of some formats, especially XML-based, requires correct output escaping. Without it your document may become broken when you put special characters like ampersand, quotes, and others in it.

Escaping can be performed in two ways: outside of the library by a software developer and inside of the library by built-in mechanism. By default, the built-in mechanism is disabled for backward compatibility with versions prior to v0.13.0. To turn it on set outputEscapingEnabled option to true in your PHPWord configuration file or use the following instruction at runtime:

\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);

@kamleshwebtech
Copy link

\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true); worked for me. Thanks a lot @tfak :)

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

No branches or pull requests

4 participants