bardecode.com

  • Increase font size
  • Default font size
  • Decrease font size
Home Knowledge Base Unicode problems in Delphi 2009

Unicode problems in Delphi 2009

Delphi 2009 developers may have found some issues passing strings to and from the toolkit. This seems to be down to unicode support in Delphi 2009 and can be resolved with some simple code changes.

For example, in previous versions of Delphi you might have code similar to:

NumCodes:=stScanBarCode(PChar(OpenDialog1.FileName));

...but in Delphi 9 this needs to change to:

NumCodes:=stScanBarCode(pChar(UTF8String(OpenDialog1.FileName)));


There are similar issues getting at the results of a scan.

In previous versions you could simply call stGetBarString(i), but in Delphi 9 you must use the following:

pAnsiChar(stGetBarString(i)

Download a sample project for Delphi 2009

Many thaks to Tom Dieckhoff for working this out.