HOME | SOLUTIONS | INDUSTRIES | SERVICES | ABOUT US | NEWS & EVENTS | SUPPORT CENTER | CONTACT

 
Product Documentation
Dovetail SelfService
Knowledge Base
Support Forums
Employee Blogs
Contact Us

cbbatch and extended or accented characters (Article # 76)

View products that this article applies to.

Problem:

cbbatch seems to corrupt extended characters.

Example program:

Option Explicit

Const first_name = "Larrañaga"
Const last_name = "Núñez"
Const phone = "512"

Public Sub test()

Dim br as New BulkRetrieve
Dim recContect as Record
Dim TheList as List

br.SimpleQuery 0, "contact"
br.AppendFilter 0, "first_name", cbEqual, first_name
br.AppendFilter 0, "last_name", cbEqual, last_name
br.AppendFilter 0, "phone", cbEqual, phone
br.RetrieveRecords
Set TheList = br.GetRecordList(0)

Debug.Print ""
If TheList.Count > 0 Then
  Debug.Print "Successfully found contact " + first_name + " " + last_name
Else
  Debug.Print "Could NOT find contact " + first_name + " " + last_name
End if
Debug.Print ""

End Sub

 

Resolution:

Background
On a machine running Windows NT/2000, there are three character sets at play: the OEM character set, the ANSI character set, and Unicode. The OEM character set rules in the command-line world and affects the tools that are normally run from the MS-DOS prompt, such as cbbatch. The ANSI character set is used by all true Windows applications, unless they are working with a Unicode file.

The OEM character sets are a legacy from the early IBM PC days and are only useful when communicating with users who are running MS-DOS or OS/2.
SQL Server and its client libraries are able to cope with several character sets and convert data from one character set to another. Unfortunately, the scheme isn't as flexible as one might wish, and sometimes the conversions take place when you'd prefer they didn't.

The MS-SQL server has an option you can turn on or off the OEM-ANSI conversion. With this conversion on, the same piece of data you retrieve from the database will be different depending on the type (OEM vs ANSI) of the client. Since cbbatch is a command line program, the data is converted before it receives them.

So, on to how to fix the issue at hand.
From the machine running cbbatch, open up your SQL Server Client Network Utility (Start - Programs - Microsoft SQL Server - Client Network Utility) (or something similar).
On the DB-Library options tab, uncheck the "Automatic ANSI to OEM conversion" checkbox.

That should do it.

Applies To:

Copyright © 2008 Dovetail Software, Inc. All rights reserved.

 

support center | blogs | terms & conditions | contact