22using System . Collections . Generic ;
33using System . Data . Common ;
44using System . Diagnostics ;
5- using System . Text ;
65
76namespace DbfDataReader
87{
@@ -25,7 +24,7 @@ private enum Keywords
2524 private static readonly string [ ] ValidKeywords = BuildValidKeywords ( ) ;
2625 private static readonly Dictionary < string , Keywords > KeywordsHash = BuildKeywordsHash ( ) ;
2726
28- private Encoding _encoding ;
27+ private string _encoding ;
2928 private string _folder = string . Empty ;
3029 private bool _readFloatsAsDecimals ;
3130 private bool _skipDeletedRecords = true ;
@@ -57,7 +56,7 @@ public override object this[string keyword]
5756 Keywords index = GetIndex ( keyword ) ;
5857 switch ( index )
5958 {
60- case Keywords . Encoding : Encoding = DbfDbConnectionStringBuilderUtil . ConvertToEncoding ( keyword , value ) ; break ;
59+ case Keywords . Encoding : Encoding = DbfDbConnectionStringBuilderUtil . ConvertToString ( value ) ; break ;
6160 case Keywords . Folder : Folder = DbfDbConnectionStringBuilderUtil . ConvertToString ( value ) ; break ;
6261 case Keywords . ReadFloatsAsDecimals : ReadFloatsAsDecimals = DbfDbConnectionStringBuilderUtil . ConvertToBoolean ( value ) ; break ;
6362 case Keywords . SkipDeletedRecords : SkipDeletedRecords = DbfDbConnectionStringBuilderUtil . ConvertToBoolean ( value ) ; break ;
@@ -74,12 +73,12 @@ public override object this[string keyword]
7473 }
7574 }
7675
77- public Encoding Encoding
76+ public string Encoding
7877 {
7978 get => _encoding ;
8079 set
8180 {
82- SetEncodingValue ( value ) ;
81+ SetValue ( DbfDbConnectionStringKeywords . Encoding , value ) ;
8382 _encoding = value ;
8483 }
8584 }
@@ -165,11 +164,6 @@ private void SetValue(string keyword, string value)
165164 base [ keyword ] = value ;
166165 }
167166
168- private void SetEncodingValue ( Encoding value )
169- {
170- base [ DbfDbConnectionStringKeywords . Encoding ] = DbfDbConnectionStringBuilderUtil . EncodingToString ( value ) ;
171- }
172-
173167 private void SetStringTrimmingValue ( StringTrimmingOption value )
174168 {
175169 Debug . Assert ( DbfDbConnectionStringBuilderUtil . IsValidStringTrimmingOptionValue ( value ) , "Invalid value for StringTrimming" ) ;
@@ -206,7 +200,7 @@ private void Reset(Keywords index)
206200 switch ( index )
207201 {
208202 case Keywords . Encoding :
209- _encoding = null ;
203+ _encoding = string . Empty ;
210204 break ;
211205 case Keywords . Folder :
212206 _folder = string . Empty ;
0 commit comments