23

I'm using angular's currency filter and it seems to be outputting an extra symbol: Â.

The html:

{{totals.subtotal | currency}}
{{totals.tax | currency}}
{{totals.total | currency}}

The object totals:

var totals = {subtotal: 500, tax: 65, total: 565};

Output:

Â$500.00
Â$65.00
Â$565.00

Has anyone encountered this before? I'm using the latest angular 1.0.6

Update: It turns out the minification of angular caused this. When I included the non minified angular it fixed it.

Petahhh
  • 287
  • 3
  • 8
  • This looks like and encoding issue. Make sure **all** your files, resources are transferred in the **same** encoding to the browser! (`utf8` preferred) – TheHippo Apr 15 '13 at 14:57
  • No, never seen this before. Did you include any additional files with locale definitions (ngLocale module)? Could you share a plunk with a reproduce scenario? – pkozlowski.opensource Apr 15 '13 at 14:57
  • @TheHippo, I am getting the same problem on 1.1.5 regardless of including a locale file. My Angular files are not minified. – Petrus Theron Sep 05 '13 at 14:32
  • 1
    This is happening to me also, with minified angular 1.2.6. Very strange. – jraede Feb 07 '14 at 17:40
  • I was able to solve it by replacing my /vendor/angular.js file with the pre-minified version. I think something happened with uglifyjs that was causing this. – jraede Feb 07 '14 at 17:45
  • 1
    Sounds like this is solved, you should add an answer or select one :) – Resist Design Jan 30 '15 at 15:53

5 Answers5

14

Yeah confirmed that this is uglify.

If you build it with the ascii_only=true option then it seems to resolve the problem.

Benjamin Conlan
  • 762
  • 1
  • 7
  • 13
6

Make sure you have this meta tag.

<meta charset="utf-8">
Zach Shefska
  • 113
  • 1
  • 7
3

It seems that when you minify Angular yourself with Uglify.js, and possibly when you combine it with other scripts into one concatenated file and then minify, this issue arises. To solve it you should include the pre-minified version of Angular in your project instead of the development version. I'm not sure if the problem is due to Uglify.js or Angular, but this is how I fixed it.

jraede
  • 6,846
  • 5
  • 29
  • 32
0

Updating Uglify seems to resolve the issue together with

uglify({ 'ascii-only': true })
Toolkit
  • 10,779
  • 8
  • 59
  • 68
0

If you build it with the ascii_only=true option then it seems to resolve the problem.

Here is what it should look like in your Gruntfile.js:

uglify:{ 
     options: { 
         output: {'ascii_only': true } 
     }
}
Ivan Vovk
  • 929
  • 14
  • 28