nooaa
nooaa

Reputation: 399

MVC string encoding issue in jquery

I have some code like the following.

.... some jquery code here .....
var fullAddress = '@Model.AddressParseResult.normalizedAddress.ToString()';

alert(fullAddress);
.... some jquery code here .....

The value of the "normalizedAddress" is "içerenköy" (it has turkish letters). However in alert window i get the result like:

içerenköy

I think i am doing something wrong about chracter encoding. Any idea how can i get the correct string ?

Upvotes: 1

Views: 838

Answers (2)

ramazandonmez
ramazandonmez

Reputation: 41

exactly, you should use like this:

var address = '@Html.Raw(Model.AddressParseResult.normalizedAddress.ToString())';

Upvotes: 1

anssi
anssi

Reputation: 739

@Html.Raw should put the correct encoding in place.

Upvotes: 2

Related Questions