Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 27th, 2018, 01:08 PM
Registered User
Join Date: Nov 2018
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default decoding iso -8859-1 to UTF-8 including font


I need to convert a ISO-8859-1 to UTF-8 so that I can create a barcod with croatian font (ČĆŽŠĐ). I tried this code but did not get the Croatian letters
Public Function Utf8BytesFromString(strInput As String) As Byte()

    Dim nBytes As Long
    Dim abBuffer() As Byte
    ' Catch empty or null input string
    Utf8BytesFromString = vbNullString
    If Len(strInput) < 1 Then Exit Function
    ' Get length in bytes *including* terminating null
    nBytes = WideCharToMultiByte(CP_UTF8, 0&, ByVal StrPtr(strInput), -1, 0&, 0&, 0&, 0&)
    ' We don't want the terminating null in our byte array, so ask for `nBytes-1` bytes
    ReDim abBuffer(nBytes - 2)  ' NB ReDim with one less byte than you need
    nBytes = WideCharToMultiByte(CP_UTF8, 0&, ByVal StrPtr(strInput), -1, ByVal VarPtr(abBuffer(0)), nBytes - 1, 0&, 0&)
    Utf8BytesFromString = abBuffer
    'MsgBox nBytes
End Function
input "ČÅ " OUTPUT Ȋ

Public Function tlhAsciiToUtf8(ByRef strText As String) As String
 Dim hexString As Long
 Dim newval As Long
 hexString = Val("&h" & strText)
 If hexString <= 127 Then
   tlhAsciiToUtf8 = "%" & strText
 ElseIf hexString <= 191 Then
   tlhAsciiToUtf8 = "%C2%" & strText
 ElseIf hexString <= 255 Then
   newval = 49856 + hexString
   tlhAsciiToUtf8 = "%" & Mid(Hex(newval), 1, 2) & "%" & Mid(Hex(newval), 3, 2)
   MsgBox ("NON ASCII CHARACTER: " & hexString)
 End If
End Function
same thing

please help
The Following User Says Thank You to elvira For This Useful Post:

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL and ISO date problems CallumBeveridge SQL Server 2000 6 August 17th, 2007 02:14 PM
ISO Date Problem chrislepingwell SQL Server 2000 2 May 30th, 2006 12:52 PM
how to get font ,color,font size of text in win32 satishsatao Visual C++ 0 April 5th, 2006 05:05 AM
content="text/html; charset=iso-8859-1" crmpicco HTML Code Clinic 6 June 17th, 2005 05:09 AM
decoding encoding starsol Beginning PHP 2 June 29th, 2003 08:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.