Toupper() with accents

Asked

Viewed 239 times

5

I own a string, where I wish to capitalize it, to standardize the information. I am using the ToUpper(). But when that string has accents the text gets shuffled.

How to receive text with normal accents, or remove accents and receive text correctly?

My View calling the string:

insira o có[email protected](model => model.sLotacao).ToString().ToUpper()

Result on page:

SECRETARIA M. DE EDUCAçãO

1 answer

5


Try specifying culture information by passing an object CultureInfo for the method ToUpper:

insira o código @Html.DisplayFor(model => model.sLotacao).ToString().ToUpper(CultureInfo.CreateSpecificCulture("pt-BR"))

Still, if it doesn’t work, just try not using @Html.DisplayFor.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.