0

Our system use Access VBA function Chr() to get ASCII code to generate barcode. All of computers (include Windows 10, Windows 8 and Windows 7) result of Chr() is correct while one of Windows 8.1 result is different.

For example

All computers return of Chr(209) is “Ñ” which is correct. Return of Ch(65) is “A” which is correct.

One computer return of Chr(209) is “?” which is incorrect. Return of Ch(65) is “A” which is correct.

I try to use ChrW and ChrB. Both still do not return proper ASCII. Not sure why that computer return is different. Test results from computers and seems that computer cannot return correct ASCII for 128~256 codes.

braX
  • 11,506
  • 5
  • 20
  • 33
YellowLarry
  • 383
  • 1
  • 4
  • 16

2 Answers2

1

ASCII codes were supposed to be a defined standard but that standard keeps changing. Depending on your region or your software versions you could have a mismatch in what you would expect to be returned. This is why you will see items like <?xml version=“1.0” encoding=“utf-8”?>. This tells the rest of the devices reading it the base coding that you are using.

In regards to MSACCESS I have not read how to get around this by setting the standard you wish to use. You can use the STRCONV() function to bring your code into the standard you wish.

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/strconv-function

More reading:

What is ANSI format?

How to convert MS Access database encoding to UTF-8?

For a list of all the ASCII standards please see:

http://www.iana.org/assignments/character-sets/character-sets.xhtml

Jim L
  • 173
  • 7
1

From Jim L answer and searched more info, I found the problem/solution. Return code will be correct, if I change System Locale to English.

Step to change system Locale

1. Control Panel
2. Region and Language
3. Administrative
4. Change System Locale to English
5. Restart computer

This is a solution. But, I cannot control each computer Locale and I cannot assume each computer Locale is English.

YellowLarry
  • 383
  • 1
  • 4
  • 16