M
Mark Rae
Hi,
I'm in the process if converting the data out of an old DOS-based
SunAccounts system (don't ask!) into SQL Server.
The data has been sent to me as a collection of hundreds of SunAccounts
backup files and it's a simple (yet extremely laborious!) process of opening
each backup file in turn, reading the file line by line, splitting it up
into its constituent parts, and then squirting it into SQL Server.
However, I'm experiencing a problem because Sun, being a DOS-based system,
uses ASCII encoding. Specifically, the old chestnut of the British pound
sign, which Sun considers to be hex 9c (i.e. Alt-156). However, Windows
using ANSI encoding sees this character as o instead of £ (Alt-163).
If I open the files into a StreamReader object without specifying an
encoding, C# appears to be using ASCII encoding. This has the effect of
ignoring the character completely which, in turn, throws the rest of the
import of of kilter because the file format is fixed-width, not delimted.
Therefore, can anyone please tell me what encoding I should use when reading
the file into a StreamReader object? I've tried several, but none appears to
work correctly so far. Some render the character as a question mark or a
blank square which, although not correct, at least doesn't stop the rest of
the import from working...
Any assistance gratefully received.
Mark
I'm in the process if converting the data out of an old DOS-based
SunAccounts system (don't ask!) into SQL Server.
The data has been sent to me as a collection of hundreds of SunAccounts
backup files and it's a simple (yet extremely laborious!) process of opening
each backup file in turn, reading the file line by line, splitting it up
into its constituent parts, and then squirting it into SQL Server.
However, I'm experiencing a problem because Sun, being a DOS-based system,
uses ASCII encoding. Specifically, the old chestnut of the British pound
sign, which Sun considers to be hex 9c (i.e. Alt-156). However, Windows
using ANSI encoding sees this character as o instead of £ (Alt-163).
If I open the files into a StreamReader object without specifying an
encoding, C# appears to be using ASCII encoding. This has the effect of
ignoring the character completely which, in turn, throws the rest of the
import of of kilter because the file format is fixed-width, not delimted.
Therefore, can anyone please tell me what encoding I should use when reading
the file into a StreamReader object? I've tried several, but none appears to
work correctly so far. Some render the character as a question mark or a
blank square which, although not correct, at least doesn't stop the rest of
the import from working...
Any assistance gratefully received.
Mark