Importing a Unicode file into NAV through a dataport

josephdewey
Member Posts: 87
Is there any way to import a Unicode file into Navision?
I'm trying to do a Dataport to import a unicode file with some fields that have Chinese characters, into a company that is set up in Navision to support Chinese (non-Unicode in NAV). But the Dataport doesn't recognize the Unicode characters, since Navision is a non-Unicode program (until NAV 2013).
I could do a conversion of the file before I import it, through Notepad++, to convert the file from Unicode to the Windows Code Page, so Navision could import it.
But, I need to import this file multiple times per day, so I need an automated solution, instead of just a manual solution.
Thanks in advance for your help!
I'm trying to do a Dataport to import a unicode file with some fields that have Chinese characters, into a company that is set up in Navision to support Chinese (non-Unicode in NAV). But the Dataport doesn't recognize the Unicode characters, since Navision is a non-Unicode program (until NAV 2013).
I could do a conversion of the file before I import it, through Notepad++, to convert the file from Unicode to the Windows Code Page, so Navision could import it.
But, I need to import this file multiple times per day, so I need an automated solution, instead of just a manual solution.
Thanks in advance for your help!
Joseph Dewey
Microsoft Dynamics NAV User
Microsoft Dynamics NAV User
0
Comments
-
You can write a dll for conversion and call it in Navision by automation. I prefer this approach if the automation is run by a service or only in the same machine. Otherwise registering the dll can be a problematic issue.Ufuk Asci
Pargesoft0 -
Good thoughts. Anybody have details on how I could do this, or where I could go for resources?Joseph Dewey
Microsoft Dynamics NAV User0 -
Sorry for the late reply, I was on holiday
For the dll part you can search for encoding conversion and writing a com visible dll in dotnet related resources.
Basically the result will be like the following lines in csharp:namespace ChangeColl { [ComVisible(true)] [ProgId("ChangeColl")] [ClassInterface(ClassInterfaceType.AutoDual)] [Guid("F104F5DC-9F9F-4BD3-9B77-C5AFEA75881C")] public class ChangeColl { public void SetColl(string pFilePath) { if (File.Exists(pFilePath)) { string text = File.ReadAllText(pFilePath,Encoding.Default); File.WriteAllText(pFilePath, text, Encoding.UTF8); } } } }
create your bat files to install and uninstall the dll easily. (using regasm and gacutil)
install.bat file can have the following lines:set regasm=%windir%\Microsoft.NET\Framework\v2.0.50727\regasm.exe set gacutil=.\gacutil.exe %regasm% "ChangeFileCollation.dll" /tlb:-ChangeFileCollation.tlb %gacutil% /i "ChangeFileCollation.dll" pause
and in navision write a function like:IF ISCLEAR(ChangeColl) THEN IF CREATE(ChangeColl) THEN BEGIN ChangeColl.SetColl(pFilePath); EXIT(TRUE); END; EXIT(FALSE);
Hope this helps.Ufuk Asci
Pargesoft0
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