READTEXT misinterprets "special" characters.


I am saving a sales invoice report using SAVEASHTML in C/AL.

The text in the sales invoice includes characters that include french accented letters, german with umlauts etc. The HTM file when opened through a text editor or opened in a browser looks abolutely fine and all the characters are displayed correctly.

The next stage in my application is to OPEN the HTM file to build an email, streaming in in the usual way and use READTEXT function to read 250 chars at a time. However I found that in my resulting email the accented letters had been misinterpreted. I added the MESSAGE statement shown below and sure enough the READTEXT screws things up.


°” converted to “” by READTEXT

“é” converted to “Ú” by READTEXT

“ç” converted to “Þ” by READTEXT

Has anyone any idea how to resolve this issue? Pleeeez! & Thanks for taking the time to read this!

If you feel inclined try it - create a text file with above examples, then open it withthis code…

NextLine Text 250
InFile File
Int Integer
FileInStream InStream

WHILE NOT (FileInStream.EOS()) DO
Int:= FileInStream.READTEXT(NextLine,250);

This is because Navision and Windows use different codepages.

Check this to fix the problem

Hi Kriki,

Thanks very much for your help. The conversion tool has sorted out the problem. But it has introduced a new problem, in that now it converts blank spaces into “°”, which messes up the htm. Once I have worked out exactly where this occurs in the conversion function I think my problem will be fixed!

Thanks again.


During conversation you know that the person performing the upgrade should us US windows version.
Some companies try to save money and send it overseas and cause lots and lots of problems.
Keep the work in your country (Ex: USA)

But to keep things simple. Do a search string to look for non CHR characters. If found replace with “SPACE” value.

Good luck. This should occur on fields you have problems with.