Skip to main content

Burned by CodePages

I've worked with out-sourced developers from other countries and recently had a situation that had me completely dumbfounded until I found it.

In our user table, we stored encrypted passwords. When I ran the system using a standard startup process, it recognized the passed password without a problem.

Then I ran it with an automated scheduling tool and it came back with an invalid user.

So then I ran the automated scheduling tool directly from within FoxPro and it worked.

I put code coverage on it, I put in message boxes and tracking (since you can't really bring up the debugger from within a runtime app) all to no avail. The passwords used in the development or standard approach simply didn't match the ones from the automated scheduling tool.

What could the problem be?
I knew it had to be the codepage.

I tried checking the various code pages on the open files. They all appeared to be the same but then I saw the problem. The automated scheduling tool was including its own CONFIG.FPW in the project.

For those who aren't familiar with this technique, if you include the CONFIG.FPW in the VFP project file, you can provide your own settings for startup, such as SCREEN=OFF and other settings.

The code had been written by a development group from the Ukraine and when I reviewed the CONFIG.FPW, it was marked with CODEPAGE=1251 and CPCOMPILE=1251.

As a result, any of the tables opened afterwards would translate the fields incorrectly. So the character that was stored as Chr(65) was actually being read by the automated tool as Chr(192).

Simple to resolve, but frustrating to track down - I KNEW what the problem was but I forgot they had included the CONFIG.FPW in the file.

In addition, it's a good idea to verify configuration files (like the CONFIG.FPW) when dealing with remote developers, especially from countries who will use different codepages. I've been in the position before when dealing with remote developers but most of them are North American. As developers start to share work with other developers around the world, be aware of the codepage issues.

Comments

Anonymous said…
Here's a requirement to include in the assignment for the contracter:
'ALLOWEXTERNAL ON'
must be put in the Config.fpw that's included in the compiled app
That way you can overrule all settings they are putting in there.

Regards,
Sietse Wijnker

Popular posts from this blog

Blogs and RSS come to Microsoft.com

MS has just introduced their portal and it's pretty comprehensive. Nothing quite like learning that some people use AIM instead of MSN messenger, or that there really may be a need for supporting 4 monitors ( Cyrus Complains ) However, it's really a great sign that MS is serious about supporting the blogging community which seems to have um, exploded in size in the past year. Blogs and RSS come to Microsoft.com

FoxInCloud Stats

FoxInCloud sent this link a while back about their statistics regarding visits to their site: http://foxincloud.com/blog/2017/12/27/VFP-community-lessons-from-foxincloud-site.html What's interesting here is the breakdown of people. Yes, I think it's understandable that the Fox community is getting older. Another factor is the growth of the mobile and web environments taking over development. These environments really do push people towards the newer non-SQL or free SQL/hosted environments but more towards hosted storage options like Amazon and Google. A tool like FoxInCloud that helps MOVE existing applications to the cloud inherently competes with those environments. But FoxInCloud also allows developers to extend their application further by giving them a starting point using Javascript and the basic CSS (such as Bootstrap). If you're not rebuilding your application from scratch, it's certainly a great step forward. FoxPro VFP

5 Great Reasons to attend Virtual FoxFest

What's coming up? Virtual FoxFest is coming up soon (sessions start October 14th). Like last year, the conference is entirely virtual yet includes great breakdown rooms and sessions to add that nice one-on-one feel that you get in person. It's also staggered so you can choose which days you want to attend - October 14th, 20th and 26th. This is great if you can't break away for a consecutive three days. But really, I've gone through the sessions and I see five great sessions that I'm eager to check out. 1. A Decade of Thor (Rick Schummer) Thor has been an extension for Visual FoxPro that many developers swear by, yet many don't know even exists. Visual FoxPro's built-in extensions are great but Jim Nelson's Thor supercharges your IDE. I can't believe it's been ten years - so Rick's session should be able to not just whet your appetite but give you all the reasons you should be using it. 2. VFP C++ compiler.  Last year, we saw DotNetX as well