Angularjs: Latin / Spanish character showing as junk character -


js:

$scope.test = 'amidación'; 

html:

<span ng-bind-html="test"></span>     

output:

amidaci�n    

issue: getting latin character ó in output � junk character, tried ngsanitize didn't resolved. idea how can render correctly ?

note: can't convert latin character ascii or hexadecimal because json data.

basically need sanitize text using $sce, needto make html trusted using $sce.trustashtml method.

code

angular.module('app', [])   .controller('maincontroller', ["$scope", "$http", '$sce',     function($scope, $http, $sce) {       $scope.test = $sce.trustashtml('amidación');     }   ]); 

working plunkr

update

more better way create own filter can act reusable component

markup

<span ng-bind-html="test | unsafe"></span>  

filter

app.filter('unsafe', function($sce) {     return $sce.trustashtml; });  

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -