Search code examples
javascriptangularjsangular-translate

AngularJS Translate with UTF-8 characters


I have a problem with the translate of angular, I have this code:

app.config(function ($translateProvider) {


var lang = document.documentElement.getAttribute('lang');
  var locale;


 $translateProvider
  .useSanitizeValueStrategy(null)
   .useStaticFilesLoader({
                  prefix: 'langs/lang_',
                  suffix: '.json'
              })
 .determinePreferredLanguage(function () {
                  return lang;
              })
.fallbackLanguage('ES');
});

app.controller('Ctrl', function ($scope, $translate) {
  $scope.changeLanguage = function (key) {
    $translate.use(key);
  };
});

And i use tags like this:

translate="film_title"

The problem is that the accents and other characters are not displayed correctly, appanrently everything works correctly except for that, any ideas? I've tried changing the value of sanetize and the problem still here.


Solution

  • I solve this Saving with Sublime Text the Json file with enconding UTF-8, i hope this help someone.