So maybe somewhere in the code a wrong codepage is passed this this Win32
API call.

That won't raise an exception unless some wrapper function throwed one.

I sorted the problem out and it was not ICS (as what we agreed on already).

FYI

I use a save file dialog and allow the user to choose what encoding to use.
For that I use an example from the CodeGear help files.

{code:cpp}

Encodings->AddObject("ANSI", TEncoding::Default); // Default is ANSI
Encodings->AddObject("ASCII", TEncoding::ASCII);
Encodings->AddObject("UNICODE", TEncoding::Unicode);
Encodings->AddObject("UTF8", TEncoding::UTF8);
Encodings->AddObject("UTF7", TEncoding::UTF7);
SaveDialog->Encodings->Assign(Encodings);
// ...
int EncodingIndex = SaveDialog->EncodingIndex;
TEncoding* Encoding = dynamic_cast<TEncoding*>(SaveDialog->Encodings->Objects[EncodingIndex]);
Edit->Lines->SaveToFile(FileName, Encoding) ;

{code}

I had NO idea that default ASCII (20127) may not be available on a user's system. Two people who reported the problem did not have it checked by default in the regional settings.
As a result using "TEncoding::ASCII" VCL throws an exception.


I now do the following:

{code:cpp}

try {
Encodings->AddObject("ANSI", TEncoding::Default); // Default is ANSI
}
catch(...) {}
try {
Encodings->AddObject("ASCII", TEncoding::ASCII);
}
catch(...) {}
try {
Encodings->AddObject("UNICODE", TEncoding::Unicode);
}
catch(...) {}
try {
Encodings->AddObject("UTF8", TEncoding::UTF8);
}
catch(...) {}
try {
Encodings->AddObject("UTF7", TEncoding::UTF7);
}
catch(...) {}

{code}

And ASCII is nicely skipped when not available.
I had NO idea that ASCII in fact could be disabled in the regional settings
or that a default installation would not enable it.
For safety I obviously do the same to all the other code pages as well



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to