Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collapsing spaces in resource file in ASP.NET

I use the following for page title and I want to show n number of white spaces after page title.

<data name="PageResource1.Title" xml:space="preserve">
   <value>My Page Title                                                                                             </value>
</data>

But the spaces are rendered as a single space. :(

I can not use non-breakable space in resx file. I get following

enter image description here

like image 350
Rauf Avatar asked Sep 18 '25 10:09

Rauf


2 Answers

You can't use &nbsp; in an xml file as it's not a recognised entity. It's also content that's encoded into the xml file. The xml file needs to store the double encoded value.

You need to use either: &amp;nbsp; or <![CDATA[&nbsp;]]>

like image 157
Simon Halsey Avatar answered Sep 19 '25 22:09

Simon Halsey


You should use &nbsp; instead of white space.
<value>My Page Title&nbsp;&nbsp;&nbsp;...

like image 40
Marco Avatar answered Sep 19 '25 22:09

Marco