If I have an <input type="email">, and the user enters an Internationalized Domain Name, Angular (EDIT: except it's not Angular's fault - see my answer for details) automatically converts the value to punycode, which is a nice feature, but very confusing for users if the value is displayed back to them. E.g.
abc@ábc.com becomes
[email protected] It also causes issues when a backend is expecting the original Unicode version of the domain, and the Angular app instead sends the punycode version.
I can use e.g. punycode.js to convert it back, but is there a way to do this in Angular without involving another library - either tell Angular not to do the encoding, or get the original value subsequently?
var myApp = angular.module('myApp',[]); function thing($scope) { } <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <body ng-app="myApp"> <p>Copy this text into the input:</p> <p>abc@ábc.com</p> <div ng-controller="thing"> <input id="inp" type="email" class="form-control" ng-model="addr"> <p>Model gets: {{addr}}</p> </div> </body>
chrome email punycode, that question comes up straight away. Your answer below is a good point though!