Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 27th, 2018, 01:08 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Nov 2018
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default decoding iso -8859-1 to UTF-8 including font

Hello

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
Code:
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 Ȋ

I TRIED TOO
Code:
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)
 Else
   MsgBox ("NON ASCII CHARACTER: " & hexString)
 End If
End Function
same thing

please help
Reply With Quote
The Following User Says Thank You to elvira For This Useful Post:
thietkenhahomegroup (November 29th, 2018)
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 04:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.