How to Convert Codepage 1250 to 852 (middle Europe) to import text

NAVFuchsNAVFuchs Posts: 39Member

I want to import text (just once for setup) in NAV 2009 R2 codepage 1250 text. As I understand, I have to convert to codepage 852 to
import it per Dataport.

Does anybody know how to convert it in a correct way. A solution via Notepad++ would be also fine.

Did't geht the right way so far.



  • SunsetSunset Posts: 146Member
    Don't just take my word for it, test it yourself
  • KowaKowa Posts: 867Member
    edited 2017-08-10
    I have written PowerShell scripts for this. All you need to do is to exchange your required codepage numbers in the script.
    In your case it would look like this:
    Function Convert_ANSI1250_OEM852
                $args = resolve-path $args
                $WorkingFolder = Split-Path -Parent $args
                $sourceEncoding = [System.Text.Encoding]::GetEncoding(1250)
                $targetEncoding = [System.Text.Encoding]::GetEncoding(852)
                $convertedFileName = [System.IO.Path]::GetFileNameWithoutExtension($args) +"_OEM852" + [System.IO.Path]::GetExtension($args)
                $convertedfile = New-Item -path "$WorkingFolder\$convertedFileName" -type file
                $textfile = [System.IO.File]::ReadAllText($args, $sourceencoding)
                [System.IO.File]::WriteAllText($convertedfile, $textfile, $targetencoding)
                Write-host $args 'converted to' $convertedFileName

    Call the function together with the path to your source file, the converted one will be written to the same folder.

    Keep in mind that further processing into NAV requires your OS regional settings to have a country in middle europe that uses these codepages (like PL, CZ, etc.) as well for the special characters to look right (also for the Windows editor, in Notepad++ you can change the codepage encoding settings to check the result visually beforehand).
    Kai Kowalewski
  • krikikriki Posts: 8,455Member, Moderator
    I think I used this one in the past :

    I also found another one :

    All nicely inside C/AL without .exe, .dll, or PoSh.
    Regards,Alain Krikilion
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2018: 22 & 23 November 2018, Antwerp (Belgium)
  • KowaKowa Posts: 867Member
    edited 2017-08-14
    Keep in mind that most ANSI2ASCII-tools were made from the viewpoint of codepages in Western Europe.

    Western Europe, Skandinavia, also Estonia
    ANSI = Codepage 1252
    ASCII = Codepage 850
    In Central/Eastern Europe (without Baltic States)
    ANSI = Codepage 1250
    ASCII = Codepage 852
    Baltic States
    ANSI = Codepage 1257
    ASCII = Codepage 775

    That's why I created these scripts. You can easily adjust them for all purposes.
    Kai Kowalewski
Sign In or Register to comment.