Text File UTF-8 Encoding

EL_TORRESHDZ
Member Posts: 3
Hi can you guy helpme I want to write a text file from navision i can write in the file but som characters as Á or é are not correct when I open the file in the note pad I think it is because of the encoding navision save it in ANSI i think is that. ](*,)
0
Comments
-
NAV uses internally and when writing files ASCII, not ANSI. You will need to convert the data to ANSI before writing the file. Search the forum for ASCII ANSI, you will find lots of tips.Frank Dickschat
FD Consulting0 -
Thanks now i can write character like é and Á in the text file encode ANSI but I need write the text file from NAV in default encode UTF-8 not in ANSI0
-
This can be done using PowerShell.
.tmp file is temporary ANSI file, ptFileName is a full path to file (ie. c:\temp\filename.txt)WHS Automation 'Windows Script Host Object Model'.WshShell IF ISCLEAR(WHS) THEN CREATE(WHS) ; pwrShell := '%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe' ; pwrShellCmd := STRSUBSTNO('"Get-Content %1.tmp | Out-File %1 -Encoding UTF8"',ptFileName) ; whsWait := TRUE ; i := WHS.Run(pwrShell + ' ' +pwrShellCmd,whsWait,whsWait) ; ERASE(ptFileName+'.tmp') ;
0 -
Hi
Just my 2 cents in this:
In 2013 there was a new System-Property "Textencoding" introduced. Have a sample here:
http://msdn.microsoft.com/en-us/library ... 1(v=nav.71).aspx
Using this, I think you don't need ASCIItoANSI Conversion anymore while exporting data.
Hope this helps.
Thomas0 -
I have written some PowerShell conversion functions which you can easily adapt to all existing codepages by selecting the source/target file encoding.
http://www.msdynamics.de/viewtopic.php?f=17&t=25726
Keep in mind that these conversion can only work properly if a special character is part of a specific codepage. You can convert any codepage to unicode but not vice versa if the file contains characters which can't be mapped.
Don't import these converted files to NAV without converting them back to the OEM codepage, unless you can make use of the file encoding parameter that was introduced in NAV 2013 R2.Kai Kowalewski0 -
Hi
I have used
http://blogs.msdn.com/b/nav/archive/201 ... -2013.aspx
to export / import files with Swedish special signs åäö..
Regards
ChristerRegards
Christer in Stockholm, Sweden0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions