How to use CHARSET correctly in AngularJS

2

I'm starting in Angular and I'm having a basic question .. When I pass data from one form to another presentation screen, the accented characters are being presented all messed up. Please help me to identify why the script below is not working.

		var config = {
                headers : {
                    'Content-Type': 'application/json;charset=iso-8859-1'
                }
            }
				$http.post('views/protected/apresenta_result.php', data, config)
		        .success(function(data, status, headers, config)
		        {
					sucesso();
		        })
		        .error(function(data, status, headers, config)
		        {
		            console.log('error');
					erro();
		        });
    
asked by anonymous 26.08.2016 / 18:00

1 answer

2

You need to set an Accept in the header.

Accept: application/json;charset=UTF-8
Accept-Charset: UTF-8
    var config = {
                headers : {
                    'Accept': "application/json;charset=utf-8',
                    'Accept-Charset':"charset=utf-8',
                    'Content-Type': 'application/json;charset=iso-8859-1'
                }
            }
                $http.post('views/protected/apresenta_result.php', data, config)
                .success(function(data, status, headers, config)
                {
                    sucesso();
                })
                .error(function(data, status, headers, config)
                {
                    console.log('error');
                    erro();
                });
    
27.03.2017 / 01:06