+ Reply to Thread
Results 1 to 2 of 2

How to convert a string (other than english) to UTF-8 format

  1. #1
    Registered User
    Join Date
    10-06-2014
    Location
    india
    MS-Off Ver
    2010
    Posts
    1

    Post How to convert a string (other than english) to UTF-8 format

    Dim jpStr as String
    jpStr = "メ"
    dim byteArray() as Byte
    byteArray() = strConv(jpStr,vbUnicode)
    writing it to a file
    Dim binObj As Object
    Set binObj = CreateObject("adodb.stream")
    binObj.Open
    binObj.WriteText byteArray
    binObj.SaveToFile "D:\A4\Message_tool\surya.bin", adSaveCreateOverWrite
    Reading binary file
    Dim intFileNum, bytTemp As Byte, intCellRow
    intFileNum = FreeFile
    intCellRow = 10
    Open "D:\A4\Message_tool\surya.bin" For Binary Access Read As intFileNum
    Do While Not EOF(intFileNum)
    intCellRow = intCellRow + 1
    Get intFileNum, , bytTemp
    Cells(intCellRow, 1) = ChrW(bytTemp)
    Loop
    Close intFileNum
    Output is ÿþá 0

    what I'm expecting is "メ"

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: How to convert a string (other than english) to UTF-8 format

    Have a look at my blog post: http://excel.solutions/2014/04/using...-to-text-file/

    You can easily modify this approach to suit your requirement - I've found this a useful way of controlling the characterset of text output.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 05-07-2014, 04:56 AM
  2. English to English Dictionary in MS Excel format
    By waqaszhr in forum Excel General
    Replies: 0
    Last Post: 12-03-2012, 03:19 PM
  3. [SOLVED] how to convert arabic numbers to english text format in excel?
    By ANURAG ARPAN in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-18-2006, 12:15 PM
  4. Replies: 1
    Last Post: 08-02-2006, 02:24 AM
  5. Replies: 1
    Last Post: 08-01-2006, 08:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1