TextArea editor that doesn't mess text with nbsp's?

Vote:
 

Hi

TextArea string editor has started converting whitespaces to nbsp's after some update. It happens if there are more than one whitespace in a row, the latter one's are replaced with nbsp's (charcode 160). Perhaps a nice feature if you'r using the strings only on your views, but not so nice when you'r using them for embedded html or system configuration.

I think it's a terrible change and should be reverted to save the text as it was written. But meanwhile I'd be happy to know if there are nice and clean workarounds.

#114640
Dec 16, 2014 18:29
Vote:
 

[UIHint(UIHint.LongString)] doesn't work either.

#114641
Dec 16, 2014 18:42
Vote:
 

So this happens when you use [UIHint(UIHint.Textarea)] ?

#114642
Dec 16, 2014 19:22
Vote:
 

Yes. And with [UIHint(UIHint.LongString)] too.

#114643
Dec 16, 2014 19:24
Vote:
 

Hi, any solution to this "error" yet? 

#118335
Mar 04, 2015 15:33
Vote:
 

I created a string extension method to workaround the issue. It's used on views like @Html.Raw(Model.Html.FixNbsp())

namespace Solita.Web.Utils.Common.Extensions
{
    public static class StringExtensions
    {
        public static string FixNbsp(this string str)
        {
            // http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=114640
            // TextArea string editor converts whitespaces to nbsp's after some update. 
            // It happens if there are more than one whitespace in a row, the latter one's are replaced with nbsp's (charcode 160).
            
            const char nbspChar = '\u00A0';
            return !string.IsNullOrEmpty(str) ? str.Replace(nbspChar, ' ') : string.Empty;
        }
    }
}

Not nice, but works for now.

#118344
Mar 04, 2015 16:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.