How to force charset on ng-include

218 views
Skip to first unread message

Roger Túlio Silva

unread,
Mar 31, 2015, 3:01:44 PM3/31/15
to ang...@googlegroups.com
I'm trying to use the ng-include directive to load some parts of my template, but my special characters are messing up. I've tried set this configuration on $httpProvider.defaults.headers but it was ignored by the Angular.

Have I to use HTML codes to include my special characters?


Regards,
Roger Silva

Tandon, Rishi

unread,
Mar 31, 2015, 3:22:12 PM3/31/15
to ang...@googlegroups.com
You can use $sce (Strict Contextual Escaping), ngHtmlBindUnsafe was removed in 1.2

Sander Elias

unread,
Apr 1, 2015, 1:04:02 AM4/1/15
to ang...@googlegroups.com
Hi Roger,

Make sure your HTML uses the same charset as your server. This might be a challenge in its own.
An easy way to circumvent this, is to html-encode all your special characters on your server. Sadly, you then need $sce to display it correctly. This will add a little bit of complexity to your app.

Regards
Sander 

Roger Túlio Silva

unread,
Apr 1, 2015, 6:00:51 PM4/1/15
to ang...@googlegroups.com
Thanks guys, actually my problem was on eclipse. It wasn't saving my html files using the correct encoding.
Reply all
Reply to author
Forward
0 new messages