Menu

#20 IConfig.GetString(string, string) returns invalid content

v1.1.0
closed-fixed
INI (26)
5
2006-03-23
2005-08-22
No

Hi,

An example INI file contains a row:

[section]
key="name" <email-address@domain>

I get name when I read the value of the key "key" with
GetString(string, string) method. The
GetPrivateProfileString function of Windows API returns
full line with quotes and other special characters,
ie. "name" <email-address@domain>.

I consider this behavior as a bug.

I call GetString after I have merged three sources (two
INI-files plus command line arguments). I haven't tested
wether this function works as expected without merge.

A short introduction to the problem:

Dim iniSource1 As Nini.Config.IniConfigSource
Dim iniSource2 As Nini.Config.IniConfigSource
Dim cliSource As Nini.Config.ArgvConfigSource

iniSource1 = New Nini.Config.IniConfigSource
(some_path_1)
' adding aliases here

iniSource2 = New Nini.Config.IniConfigSource
(some_path_2)
' adding aliases here

cliSource = New Nini.Config.ArgvConfigSource
(cliArgumentsArray)
' adding switches here

iniSource1.Merge(iniSource2)
iniSource1.Merge(cliSource)

' this line shows name, NOT "name" <email-
address@domain> as it should
Console.WriteLine(iniSource1.Configs
("section").GetString("key", default_recipient_spec))

Best Regards,
Olli-Pekka Isola
olli-pekka dot isola at luukku dot com

Discussion

  • Brent R. Matzelle

    • assigned_to: nobody --> bmatzelle
    • status: open --> open-accepted
     
  • Brent R. Matzelle

    Logged In: YES
    user_id=163900

    I studied your problem and came to the conclusion that you
    are right. The behavior with quotes was added because of
    the Samba-style files. I will turn off this behavior by
    default. Thanks very much for your contribution.

     
  • Olli-Pekka Isola

    Logged In: YES
    user_id=894033

    Thanks for your quick response! I will monitor Nini project for
    the next publicly available release.

     
  • Brent R. Matzelle

    • status: open-accepted --> open-fixed
     
  • Brent R. Matzelle

    Logged In: YES
    user_id=163900

    A fix for this bug has been checked into CVS.

     
  • Brent R. Matzelle

    • milestone: 512022 --> v1.1.0
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB