File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 11using System . Text ;
22
3- namespace QuickViewFile . Extensions
3+ namespace System
44{
55 public static class StringExtension
66 {
77 private static readonly ASCIIEncoding asciiEncoding = new ASCIIEncoding ( ) ;
88
9- public static string ToAscii ( this string dirty )
9+ public unsafe static string ToAscii ( this string dirty )
1010 {
11- byte [ ] bytes = asciiEncoding . GetBytes ( dirty ) ;
12- string clean = asciiEncoding . GetString ( bytes ) ;
13- return clean ;
11+ fixed ( char * p = dirty )
12+ {
13+ for ( int i = 0 ; i < dirty . Length ; i ++ )
14+ {
15+ if ( p [ i ] > 127 ) // If character is non-ASCII
16+ {
17+ p [ i ] = ' ' ;
18+ }
19+ }
20+ }
21+ return dirty ;
1422 }
1523 }
1624}
Original file line number Diff line number Diff line change 99 <Version >1.6.0.0</Version >
1010 <ApplicationIcon >QuickViewFile.ico</ApplicationIcon >
1111 <SupportedOSPlatformVersion >7.0</SupportedOSPlatformVersion >
12+ <AllowUnsafeBlocks >True</AllowUnsafeBlocks >
1213 </PropertyGroup >
1314
1415 <PropertyGroup Condition =" '$(Configuration)|$(Platform)'=='Debug|AnyCPU'" >
Original file line number Diff line number Diff line change 1- using QuickViewFile . Extensions ;
2- using QuickViewFile . Helpers ;
1+ using QuickViewFile . Helpers ;
32using QuickViewFile . Models ;
43using System . Collections . ObjectModel ;
54using System . ComponentModel ;
You can’t perform that action at this time.
0 commit comments