Results 1 to 22 of 22

Thread: Arabic Numbers display on one machine but not another

  1. #1

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Arabic Numbers display on one machine but not another

    Hello everybody, I am using this function to convert the standard numbers

    0123456789 to arabic numbers ٠١٢٣٤٥٦٧٨٩

    It is working on one machine it does the conversion but not on another where it returns the standard 0123456789 digits. Both machines are displaying the arabic text correctly in the application, the only difference is with the numbers. Anybody have any ideas?

    Code:
    Public Function ConArNum(ByVal strStringToConvert As String) As String
    
    On Error GoTo ErrorHandler
    
    strStringToConvert = Replace$(strStringToConvert, "0", ChrW$(1632))
    strStringToConvert = Replace$(strStringToConvert, "1", ChrW$(1633))
    strStringToConvert = Replace$(strStringToConvert, "2", ChrW$(1634))
    strStringToConvert = Replace$(strStringToConvert, "3", ChrW$(1635))
    strStringToConvert = Replace$(strStringToConvert, "4", ChrW$(1636))
    strStringToConvert = Replace$(strStringToConvert, "5", ChrW$(1637))
    strStringToConvert = Replace$(strStringToConvert, "6", ChrW$(1638))
    strStringToConvert = Replace$(strStringToConvert, "7", ChrW$(1639))
    strStringToConvert = Replace$(strStringToConvert, "8", ChrW$(1640))
    strStringToConvert = Replace$(strStringToConvert, "9", ChrW$(1641))
    
    ConArNum = strStringToConvert
    
    Exit Function
    ErrorHandler:
    ConArNum = vbNullString
    
    End Function

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Arabic Numbers display on one machine but not another

    check the font in use....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by techgnome View Post
    check the font in use....

    -tg
    Thanks for your reply, both use the same font (which is Tahoma), in any case I change the charset, and make sure the font works with that charset.

    Keep in mind all arabic text is showing correctly on both machines, the problem is only with the digits.

  4. #4

  5. #5

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    Are the Regional settings the same?
    Thanks for your reply. Yes regional settings are the same. English is the main language, and Arabic is the language for non-unicode programs. All script is working perfectly except the digits.

    I even tried loading from a unicode text file, arabic text mixed with arabic numbers and the text gets displayed the numbers change to 0123456789.

    I am thinking it has something to do with the codepage used? If so is there a way of having the application use the same codepage all the time independent of the machine? (Of course the regional settings must be set for arabic).

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    What do you use to convert the non-numeric characters?
    I don't do anything, I just set the charset of the control (in this case 178), select a font that is compatible with that charset. The charcters are stored as unicode charcters.

    One thing that I noticed, I looked at the codepage of 1256 (which is arabic) here:

    http://msdn.microsoft.com/en-ca/goglobal/cc305149.aspx

    And I noticed that the digits are european digits. So maybe there is a different codepage being used on that machine that displays the arabic digits?

  8. #8
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Arabic Numbers display on one machine but not another

    Curiosity. Are both machines WinXP and above? Or is one Win2K and below?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by LaVolpe View Post
    Curiosity. Are both machines WinXP and above? Or is one Win2K and below?
    I made a mistake in my statement that it works on one machine but not on the other. It doesn't work on either machine. I was testing the code on one machine using VB6, and testing the code on another machine with access vba (which I had assumed would return the same results as VB6). It doesn't work on either machine with VB6, it works on both machines with access VBA.

    So my question then becomes, how can I make this work with VB6? Any assistance would be appreciated.

    (I am looking now into api calls like MultiByteToWideChar that may present a solution.)

  10. #10

  11. #11

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    Let me ask again about the language setting and ask which one is being used? I don't see an Arabic choice.
    1. In the Languages tab I have "Install files for complex script and right-to-left languages" checked

    2. In Advanced tab I have "Langauge for non-unicode programs" on Arabic

    This permits me to see all characters in correct arabic script except the numbers which remain standard.

    Thanks again for any input.

  12. #12

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    I tried putting the bytes in directly for example the arabic digit 4 is

    Code:
    bytArabic4(0) = 100
    bytArabic4(1) = 6
    and then calling MultiByteToWideChar but I still get the same result instead of displaying ٠١٢٣٤٥٦٧٨٩ it is displaying 0123456789. I have tried using

    Code:
    ChrW$(1636)
    again with the digit being displayed as 4. Like I mentionned before I am correctly displaying text. The problem is with digits.

    Here is the MultiByteToWideChar code

    Code:
    'ANSI to UNICODE conversion, via a given codepage.
    Public Function AToW(ByVal strArNumeral As String, ByVal lngCodePage As Long) As String
    
    Dim strBuffer As String
    Dim lngLength As Long
    Dim lngPointerToString As Long
    Dim lngPointerToBuffer As Long
    Dim lngFlags As Long
    
    On Error GoTo ErrorHandler
    
    lngFlags = 0
    lngPointerToString = StrPtr(strArNumeral)
    lngLength = MultiByteToWideChar(lngCodePage, lngFlags, lngPointerToString, -1, 0&, 0&)
    strBuffer = String$(lngLength + 1, vbNullChar)
    lngPointerToBuffer = StrPtr(strBuffer)
    lngLength = MultiByteToWideChar(lngCodePage, lngFlags, lngPointerToString, -1, lngPointerToBuffer, Len(strBuffer))
    AToW = StrConv(Left$(strBuffer, lngLength - 1), vbFromUnicode)
    
    Exit Function
    ErrorHandler:
    AToW = strArNumeral
    
    End Function

  13. #13

  14. #14

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    This probably won't help but it's worth a shot.
    Thanks, but you were right it didn't change much. I am starting to run out of ideas. It is strange that all characters except digits can be displayed in arabic.

  15. #15

  16. #16
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Arabic Numbers display on one machine but not another

    Maybe you don't have a problem. See the second comment at this site and what's said about columns 2 and 6 here. (on my display column 6 isn't actually broken out from column 5).


    (Sorry for so many posts but I just find this problem interesting.)

  17. #17

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    Have you ever been able to display an arabic number in any program?
    Hello MartinLiss, thanks for your comments. Yes, if in Regional and Language Options control panel, if you select Arabic in Standards and Formats, all the dates, currencies, numbers etc... appear in standard VBfunctions.

    i.e. If I call the Date function and put the contents in a Label caption it will be displayed in Arabic in the VB program including the numbers.

    But I don't want the user to be forced to do that, it should be enough that they install complex script and select arabic for non-unicode programs.

    In any case I didn't test yet if I did that would the numbers that appear in my ressource file or text file appear correctly. I will test that tonight and let you know. However I hope that would not be the only way as the program runs on English computers and forcing people to change their standards and formats wouldn't be acceptable for users.

  18. #18
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by Hassan Basri View Post
    Hello MartinLiss, thanks for your comments. Yes, if in Regional and Language Options control panel, if you select Arabic in Standards and Formats, all the dates, currencies, numbers etc... appear in standard VBfunctions.

    i.e. If I call the Date function and put the contents in a Label caption it will be displayed in Arabic in the VB program including the numbers.

    But I don't want the user to be forced to do that, it should be enough that they install complex script and select arabic for non-unicode programs.

    In any case I didn't test yet if I did that would the numbers that appear in my ressource file or text file appear correctly. I will test that tonight and let you know. However I hope that would not be the only way as the program runs on English computers and forcing people to change their standards and formats wouldn't be acceptable for users.
    I'm sorry but I don't understand what you're saying.

  19. #19

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Arabic Numbers display on one machine but not another

    Quote Originally Posted by MartinLiss View Post
    I'm sorry but I don't understand what you're saying.
    Sorry if I wasn't clear, what I mean is that if I go to Regional and Language options in the control panel. In the first tab (under XP) there is a section "Standards and Formats". If I select one of the Arabic formats, then all the return values of standard vb functions like date, time, SmallDate etc... follow the arabic format which includes numbers.

    So If I call the Date function in VB with the above set, and put the result into a Labal I would see the arabic numbers.

  20. #20

  21. #21
    Member
    Join Date
    May 2009
    Posts
    55

    Re: Arabic Numbers display on one machine but not another

    To view Arabic numbers (٠ - ١- ٢ - ٣ - ٤ - ٥ - ٦ - ٧ - ٨ - ٩) correctly use this font:
    Which attached with this post.
    These two fonts will force Arabic numbers display in any part of your application.
    This way also will work fine with Crystal Reports.

    Some people called them Hindi numbers, but it's wrong, Indian Numerals are different, and Indian Numerals is the origin of western numbers (Arabic numerals).

    The source of the following image is from Wikipedia.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by alMubarmij; Nov 13th, 2009 at 11:53 PM.

  22. #22
    New Member
    Join Date
    May 2013
    Posts
    1

    Re: Arabic Numbers display on one machine but not another

    If you do the following you see Arabic numbers for all application.

    Control Panel -> Regional and Language Settings

    Under Regional Options

    Choose an Arabic Locale for Standards and Formats.

    Then click Customize.

    At the bottom of the options change "Digit Substitution" to "National".

Posting Permissions

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



Click Here to Expand Forum to Full Width