Problem with CodePage (Solved by using RAW)


There are problems with some characters like : "À" when using the default CodePage 437.

This character will be transformed to "A" in destination database, so if your DB is Accent Sensitive it'll not retrieve the rows.

I've found this solution :

You can pass to BCP utility, the CodePage RAW, it means no transformations.

To do that, I needed to modify the code in 3 places in SQLAzureMWUtils project, in
theses files : BCPCommandCtrl.cs, BCPCommandProcessor.cs and ScriptDatabase.cs

I've replaced this line :
p.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(defaultLanguage["BCPCodePage"]);
by theses lines :
if (defaultLanguage["BCPCodePage"] == "RAW")
    p.StartInfo.Arguments += " -C RAW";
    p.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(defaultLanguage["BCPCodePage"]);


ghuey wrote Jun 18, 2013 at 2:57 PM


I think you can do what you want without modifying any code. In the SQLAzureMW.exe.config file (app.config) you probably changed <add key="BCPCodePage" value="437"/> to <add key="BCPCodePage" value="RAW"/> right? If you go on down in the config file, you should see this: <add key="BCPArgsOut" value=""{0}" out {1} -E -n"/>. You can modify BCPArgsOut to be this: <add key="BCPArgsOut" value=""{0}" out {1} -E -n -C RAW"/> and you should be good to go.

Let me know if this works for you.


visualbruno wrote Jun 18, 2013 at 7:19 PM

Thanks for answer, but I already try it, and it doesn't work.

ghuey wrote Jun 18, 2013 at 8:16 PM

Ok, this makes me wonder. Would you mind doing a test for me? Change the code to:

if (defaultLanguage["BCPCodePage"] != "RAW")
p.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(defaultLanguage["BCPCodePage"]);
and make sure you have BCPArgsOut as: <add key="BCPArgsOut" value=""{0}" out {1} -E -n -C RAW"/>

Let me know if that works.


wrote Oct 20, 2013 at 10:12 AM

augustocamargo wrote Oct 26, 2013 at 1:29 AM

I have the same problem, any news?