i found this code and can make connection with Quickbooks but the items name and description is in Arabic it get back like this ????????? i need help to convert it to get data from quickbooks in arabic
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Interop.QBFC14;
QBSessionManager _MySessionManager = new QBSessionManager(); _MySessionManager.OpenConnection2("", "Your App Name", ENConnectionType.ctLocalQBDLaunchUI); // _MySessionManager.OpenConnection2("", "Your App Name", ENConnectionType.ctLocalQBD); _MySessionManager.BeginSession("", ENOpenMode.omDontCare); var version = QBFCLatestVersion(_MySessionManager); short ver = Convert.ToInt16(version); IMsgSetRequest itemRequestset = _MySessionManager.CreateMsgSetRequest("US", 13, 0); IItemQuery itemQuery = itemRequestset.AppendItemQueryRq(); itemQuery.OwnerIDList.Add("0"); IMsgSetResponse responseItemRq = _MySessionManager.DoRequests(itemRequestset); IResponseList itemResponseList = responseItemRq.ResponseList; IResponse itemResponse = itemResponseList.GetAt(0); ENResponseType responseType = (ENResponseType)itemResponse.Type.GetValue(); IORItemRetList QBItemList = (IORItemRetList)itemResponse.Detail; for (int i = 0; i <= QBItemList.Count - 1; i++) { if (QBItemList.GetAt(i).ItemNonInventoryRet != null) { IItemNonInventoryRet inventoryItem = QBItemList.GetAt(i).ItemNonInventoryRet; string ListID = inventoryItem.ListID != null ? inventoryItem.ListID.GetValue() : ""; string ItemCode = inventoryItem.Name != null ? inventoryItem.Name.GetValue() : ""; // string Description = inventoryItem.FullName.GetValue() != null ? inventoryItem.FullName.GetValue() : ""; string Description = inventoryItem.FullName.GetValue(); Description= Utf16ToUtf8(Description); string MPN = inventoryItem.ManufacturerPartNumber != null ? inventoryItem.ManufacturerPartNumber.GetValue() : ""; rt1.AppendText(ItemCode.ToString() + Environment.NewLine); rt1.AppendText(Description.ToString() + Environment.NewLine); } else if (QBItemList.GetAt(i).ItemInventoryRet != null) { IItemInventoryRet inventoryItem = QBItemList.GetAt(i).ItemInventoryRet; string ListID = inventoryItem.ListID != null ? inventoryItem.ListID.GetValue() : ""; string ItemCode = inventoryItem.Name != null ? inventoryItem.Name.GetValue() : ""; // string Description = inventoryItem.SalesDesc != null ? inventoryItem.SalesDesc.GetValue() : ""; string Description = inventoryItem.SalesDesc.GetValue().ToString().ToUTF8(); string MPN = inventoryItem.ManufacturerPartNumber != null ? inventoryItem.ManufacturerPartNumber.GetValue() : ""; // string Price = inventoryItem.SalesPrice.GetValue(); Description = Utf16ToUtf8(Description); rt1.AppendText(ItemCode.ToString() + Environment.NewLine); rt1.AppendText(Description.ToString() + Environment.NewLine); } else if (QBItemList.GetAt(i).ItemInventoryAssemblyRet != null) { IItemInventoryAssemblyRet inventoryItem = QBItemList.GetAt(i).ItemInventoryAssemblyRet; // customFieldsList = string ListID = inventoryItem.ListID != null ? inventoryItem.ListID.GetValue() : ""; string ItemCode = inventoryItem.Name != null ? inventoryItem.Name.GetValue() : ""; string Description = inventoryItem.SalesDesc.GetValue() != null ? inventoryItem.SalesDesc.GetValue() : ""; string MPN = inventoryItem.ManufacturerPartNumber != null ? inventoryItem.ManufacturerPartNumber.GetValue() : ""; rt1.AppendText(ItemCode.ToString() + Environment.NewLine); rt1.AppendText(Description.ToString() + Environment.NewLine); } else if (QBItemList.GetAt(i).ItemServiceRet != null) { IItemServiceRet inventoryItem = QBItemList.GetAt(i).ItemServiceRet; // customFieldsList = string ListID = inventoryItem.ListID != null ? inventoryItem.ListID.GetValue() : ""; string ItemCode = inventoryItem.Name != null ? inventoryItem.Name.GetValue() : ""; Console.WriteLine(ItemCode); Console.WriteLine(ItemCode); rt1.AppendText(ItemCode.ToString() + Environment.NewLine); // rt1.AppendText(Description.ToString().ToUTF8() + Environment.NewLine); }
can any one help me please