473,799 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

French characters are not imported properly with bcp

Hi
I have a script that uses bcp to import data from an ascii text file
into SQL tables. The french characters are not copied properly. They
are converted to letters of the alphabet. I tried to change all the
fields to nvarchar instead of varchar and nchar instead of char, but I
got Greek characters instead.

How can I fix this?

Here is some code:
--------------------------
CREATE TABLE [dbo].[1_HLGT_HLT_COMP _f9.0] (
[hlgt_code] [int] NOT NULL ,
[hlt_code] [int] NOT NULL
) ON [PRIMARY]
GO

PRINT 'HLGT_HLT'
DECLARE @s as nvarchar(300)
SET @s='bcp MedDRA..[1_hlgt_hlt_comp _f9.0] in ' + char(34) +
'F:\MedDRA\9.0F rench\MedAscii\ hlgt_hlt.asc' + char(34) + ' -c -t' +
char(34) + '$' + char(34) + ' -r$\n -e' + char(34) +
'F:\MedDRA\9.0F rench\logs\hlgt _hlt.err.txt' + char(34) + ' -b250 -m50
-SDEV -Usa -Ppassword -h' + char(34) + 'TABLOCK' + char(34)
EXEC master..xp_cmds hell @s

Mar 24 '06 #1
8 9179
Wael (se***@rocketma il.com) writes:
I have a script that uses bcp to import data from an ascii text file
into SQL tables. The french characters are not copied properly. They
are converted to letters of the alphabet. I tried to change all the
fields to nvarchar instead of varchar and nchar instead of char, but I
got Greek characters instead.
Add -C RAW to the list of BCP options. By default, BCP assumes that
characters are in the OEM code page and will convert them to the ANSI
code page. Which results in a mess when data is already in the ANSI
code page.

How can I fix this?

Here is some code:
--------------------------
CREATE TABLE [dbo].[1_HLGT_HLT_COMP _f9.0] (
[hlgt_code] [int] NOT NULL ,
[hlt_code] [int] NOT NULL
) ON [PRIMARY]
GO


Eh, there are character columns in that table?

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Mar 24 '06 #2
Does this require any special install on the server? I tried -C863 for
Canadian French, but the server does not recognize that code page.

Mar 26 '06 #3
Wael (se***@rocketma il.com) writes:
Does this require any special install on the server? I tried -C863 for
Canadian French, but the server does not recognize that code page.


I have not heard of 863 before, but it sounds like an OEM code page.

Playing around a little, it appears that you can only use code pages
for which there are one or more collations. For instace, I tried CP852
which is Eastern Europe, but this gave me an error. On the the other
hand, 874 worked. (There are a number of Thai collations with that code
page.)

But is your file really in code page 863? And in such case how different
would it be from code page 850? (My standard source for checking out
code pages is down, so I can't check right now.)

Did you try -C RAW?
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Mar 26 '06 #4
I tried -C RAW but i got an error. If you check the windows regional
settings, you'll see 863 is the code page for Canadian French.

Regional and Language Options\Advance d

Mar 27 '06 #5
Wael (se***@rocketma il.com) writes:
I tried -C RAW but i got an error.
An error? Care to specify what? It's difficult to assist without knowing
the error message.
If you check the windows regional
settings, you'll see 863 is the code page for Canadian French.

Regional and Language Options\Advance d


Yes, I also see that it is an OEM code page. Is the data file in this
code page?
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Mar 27 '06 #6
For question number 1, the error is pasted below.
For the second one I am not sure. The original text is a plain text
file.

NULL
Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Code page 863 is
not supported by SQL Server
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to resolve column
level collations
NULL
BCP copy in failed
NULL

(9 row(s) affected)

Mar 29 '06 #7
Wael (se***@rocketma il.com) writes:
For question number 1, the error is pasted below.
For the second one I am not sure. The original text is a plain text
file.


If you the open file in Notepad, does it look good then? If it does,
it is not an OEM file. If the French characters are replaced with
other single characters, it could be CP863.

If the file looks bad in Notepad, does it look good when you type it
from a command-line window.

I'm a little surprised of the message you got with -C RAW. I was under
the impression that this would suppress all code-page conversion.

Anyway, if the file looks good in Notepad, use -C ACP or -C 1252.

If it looks goot in the command-line window, try -C 850. I don't know
about CP 863, but I would expected to be a version of CP 850.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Mar 29 '06 #8
It worked. ACP worked.

THank you very much.

Mar 30 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2771
by: Mirza Khodabaccus | last post by:
Hi, Thanks for the reply that Mr John Robert sent me, but i have already tried the urlencode and urldecode but it did not work. my question is that, I am having a big problem reading french characters from the query string, that is from the url.
5
2852
by: darin dimitrov | last post by:
Hello, How can I convert an url encoded string containing some french characters back to the original string? I have the following html form: <form> name = <input type="text" name="name" value="Noël Pirès"/> <input type="submit" value="OK"/> </form>
1
2666
by: Gina | last post by:
Hi everybody: I need some help to load in the as/400, a file with fields that have french characters . I have created a file with language = FRC and ccsid = 500 and also I have tried with ccsid = 297 but when I load the file , the french characters does not appear correctly. Please let me know what is missing? The file that I'm loading comes in a tape and I'm making a copy from tape to the file created with the above specifications.
8
393
by: Ess355 | last post by:
Hi, In the debugger at run time, characters like é are not recognised by their normal ASCII number, but something like -8615722... . I've seen this number before, it means "rubbish" right? So how can I possible modify my program so that french characters get recognised? Thanks in advance,
4
6675
by: Lu | last post by:
Hi, i am currently working on ASP.Net v1.0 and is encountering the following problem. In javascript, I'm passing in: "somepage.aspx?QSParameter=<RowID>Chèques</RowID>" as part of the query string. However, in the code behind when I tried to get the query string value by calling Request.QueryString("QSParameter"), the value I got is: "<RowID>Chques</RowID>". The special character "è" has been stripped out. The web.config file is...
1
1645
by: prasadoo | last post by:
Hi everyone, I am trying to populate DropDownList with French characters but for some characters like é,d' etc.it is not showing the exacts French characters. Can anybody help me how to populate DropDownList with French characters.
7
20314
chunk1978
by: chunk1978 | last post by:
i though i had this under control, but i'm completely lost... i have a form which allows a user to fill out information, which is then emailed to myself as well as themselves... the form is obviously sent by PHP mail. everything seemed to be working when i text encoded the sent email with UTF-8... but then i tried it in Yahoo Mail, and i got those "?" symbols where french characters like "é" or "ç" were suppose to be... i've read up...
1
1533
by: jgershonw1 | last post by:
I have a file that is UTF-8 encoded which contains french words. The french characters are represented as two characters. Take for example an accented e, which is A with a tilda ontop and the copyright symbol. How would I go about translating Téléjournal to Téléjournal?
4
5852
by: Rob | last post by:
Hi, I have a small VB.Net program that reads in an HTML file using a FileStream (this file was created by MS Word "Save as HTML" feature), uses regular expressions to remove all unwanted code and then re-writes the file. It works fine but when I execute this on a french web page...the StreamWriter removes all of the french characters. Here's a piece of the code:
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.