Quick background...
I have a file that is currently in Bulgarian (not unicode) that we want to import into a development environment for testing. However, the only way I can view the file as "non-gibberish" is for me to switch my local settings (on the OS) to Bulgarian. Then of course the file is readable in Bulgarian.
Now they have sent the following snipet of code asking if I can somehow add this to the DTS package? The purpose of this code is to...
They're sending me a C# routine to transpose the 10 or so Bulgarian-specific characters in the text fields.
They hope we can include this routine in the DTS package.
Here is the code...
private string StrFix( string InStr )
{
string Result = InStr;
Result = Result.Replace( '\x2591', '' );
Result = Result.Replace( '\x2592', '' );
Result = Result.Replace( '\x2593', '' );
Result = Result.Replace( '\x2502', '' );
Result = Result.Replace( '\x2524', '' );
Result = Result.Replace( '\x2561', '' );
Result = Result.Replace( '\x2562', '' );
Result = Result.Replace( '\x2556', '' );
Result = Result.Replace( '\x2555', '' );
Result = Result.Replace( '\x2563', '' );
Result = Result.Replace( '\x2551', '' );
Result = Result.Replace( '\x255d', '' );
Result = Result.Replace( '\x255b', '' );
Result = Result.Replace( '\x2510', '' );
Result = Result.Replace( '\x2552', '' );
return Result;
}
My questions... (as I'm not familiar with C#)
1. Do you guys see anything I'm not?
2. Is it possible to add this code to DTS package and have it change the 10 characters?
3. Wouldn't this be easier if their sample was in unicode?
Thanks in advanceThe question boils down to "which Bulgarian" are they using? When I hear Bulgarian associated with data files, I assume they mean Code Page 1251 which is Cyrillic. From the C# code, it looks like they are expecting one of the roman code pages, like 1250 or 1257. Those two code pages aren't very compatible.
If you can figure out which code page they can use to view the data as they expect to see it, you can use that same code page with either BCP or the BULK INSERT command to import the data from the file into a Unicode column and life ought to be lovely.
-PatP
Friday, March 9, 2012
DTS (international question)
Labels:
background,
bulgarian,
database,
dts,
environment,
file,
import,
international,
microsoft,
mysql,
oracle,
server,
sql,
unicode
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment