locked
Diacritics in Small Basic RRS feed

  • Question

  • Hello all,

    I'm a new user of Small Basic.  I'm learning it for a grad class on localization.  We got an assignment to develop, internationalize, and translate a small program.  I've been able to do all of the above, but when I translate my program from English into Spanish, the diacritics (i.e. the characters with accents and the inverted exclamation points and question marks) don't show up properly.  They are instead displayed as regular question marks.

    I've been researching this problem for hours and can't figure out how to fix it.  Someone please help!

    Monday, February 3, 2014 8:57 PM

Answers

  • You have 3 options to make it going:

    1.)  Open your file 'localizeme_Spanish.txt' in eg. Notepad again and save it as UTF8 encoded.  In Notepad - Menu File - Save As... - change 'Encoding' from ANSI to UTF-8. Your Code should work then.

    2.) Install LitDev - Extension (or see links above), restart Small Basic then and import ID: LJQ402  from SmallBasic menu point 'Import'.

    3.) similar to 2.) but additional you'll have to rewrite your code. Instead of using LDFile.ANSItoUTF8 from 2.) you can use LDFile.ReadANSI, which will read full content of 'localizeme_Spanish.txt' as a compatible text string, but you will then have to split this text into lines at every CrLf,

    where CrLf = Text.Append(Text.GetCharacter(13), Text.GetCharacter(10))

    PS: It''s easier for us to help you, if you simply copy/paste your CODE here, instead of posting a screenshot picture, to allow us copy and running your code. The resulting Output picture of yor TextWindow instead is very good to show what's happening.

    PPS: Could not run your code, because of missing 'localizeme_Spanish.txt' and incomplete Screenshot.

    Hope i wrote all correct in ID LJQ402 under 2.)

    Wednesday, February 5, 2014 5:04 PM
    Answerer

All replies

  • Never had any problems on writing SB programs localized in Portuguese myself!  @_@

    Here's a good example: SZM205


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Monday, February 3, 2014 9:17 PM
    Answerer
  • I guess you need to load the text strings for localization from a text file (.lng, .lang or .txt etc). Then your problem is well known and LitDev just created an extension facing this � character problem.

    See here Read Ansi files with characters above 127 in SB

    You can download LitDev's extension here LitDev - SmallBasic Extension

    and notice the new 2 Operations in LitDev.dll:  LDFile.ANSItoUTF8 and LDFile.ReadANSI.

    More Info about both methods here:

    LDFile.ANSItoUTF8

    LDFile.ReadANSI



    Tuesday, February 4, 2014 11:45 PM
    Answerer
  • Hi all,

    Thanks for your responses.  Unfortunately I'm so new to programming that I don't understand much of anything on the links you posted.  Could someone explain the problem and solution in a non-technical way?

    Here's a screenshot of the program I wrote in SB:

    And here's one of the program actually running, showing the diacritics problem:

    Thanks in advance for your help!

    Wednesday, February 5, 2014 3:46 PM
  • You have 3 options to make it going:

    1.)  Open your file 'localizeme_Spanish.txt' in eg. Notepad again and save it as UTF8 encoded.  In Notepad - Menu File - Save As... - change 'Encoding' from ANSI to UTF-8. Your Code should work then.

    2.) Install LitDev - Extension (or see links above), restart Small Basic then and import ID: LJQ402  from SmallBasic menu point 'Import'.

    3.) similar to 2.) but additional you'll have to rewrite your code. Instead of using LDFile.ANSItoUTF8 from 2.) you can use LDFile.ReadANSI, which will read full content of 'localizeme_Spanish.txt' as a compatible text string, but you will then have to split this text into lines at every CrLf,

    where CrLf = Text.Append(Text.GetCharacter(13), Text.GetCharacter(10))

    PS: It''s easier for us to help you, if you simply copy/paste your CODE here, instead of posting a screenshot picture, to allow us copy and running your code. The resulting Output picture of yor TextWindow instead is very good to show what's happening.

    PPS: Could not run your code, because of missing 'localizeme_Spanish.txt' and incomplete Screenshot.

    Hope i wrote all correct in ID LJQ402 under 2.)

    Wednesday, February 5, 2014 5:04 PM
    Answerer
  • Thanks, @Pappa Lapub!  Changing the encoding of the .txt file from ANSI to UTF-8 did the trick.  And I'll remember your tips regarding screenshots for next time.

    Thanks again, all!

    Wednesday, February 5, 2014 6:55 PM
  • On request, here will be hexed as well.

    Glad it works. See ya.

    Wednesday, February 5, 2014 7:50 PM
    Answerer