TSilang 6.0.2, Delphi 7 and Vietnamese

All announcements, questions and issues related to the TsiLang Components Suite.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

TSilang 6.0.2, Delphi 7 and Vietnamese

Post by amos »

Hi

We are trying to see Vietnamese using Delphi 7. We changed the regional options to Vietnamese, received a .sil file containing Vietnamese words and opened it in the SilEditor and the Vietnamese was visible as expected.

The problem was when we loaded the file into our application, once we did that, the captions were in Gibberish instead of Vietnamese. In the forum we saw some posts about this problem with the sileditor but no matter what we tried to do, we didn't see Vietnamese once we imported it into delphi (in SilEditor it's ok)

please advice
thanks
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

Delphi 7 VCL is ANSI but Vietnamese is Unicode language. In order to perform the conversion from Unicode to ANSI and vice versa it is necessary to have Charset information. Unfortunately Delphi 7 doesn't have any charset defined that will support Vietnamese. The only option I would try is the following:
1. Set regional options to Vietnamese as well as Language forn Non-Unicode programs.
2. Use DEFAULT_CHARSET as a charset for Vietnamese.
3. Store SIL file as Ansi not as UTF-8
4. And then to try to load it into Delphi. This will enforce Delphi to use default locale to perform the characters conversion and might work.
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

Thank you for your reply.

The thing is that even in SIL editor itself, when working on a computer with Vietnamese location/language for non-unicode etc, the text became ? instead the Vietnamese characters after saving the file. The only way we could save and see Vietnamese was by changing the file to UTF8.

So now that the file was UTF8 and we saw Vietnamese we import it into Delphi but fail for the mentioned reason.

If I understood you correctly, you say that Delphi 7 does not support Vietnamese specifically as it doesn't have the right charset for it?
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

an example

Post by amos »

This is what I have in SilEditor:
tiếng Việt

This is what I have after importing to Delphi
tiếng Việt

The above is when the file is UTF8, when working in ANSI, the unicode characters become "?" when moving to another section and then back to "captions" or when saving the file, meaning I have to work in UTF8 mode.

It could be that the problem is that the "file" inside the app is ANSI while the sil file is UTF8 (as it works only when the file is UTF8). If I paste Vietnamese inside the SIL file, I get Vietnamese, If I paste the same thing inside my app when opening the TsiLang component, I get "?" instead of Vietnamese, I guess the solution could be by converting the TsiLang in my project to UTF8 as well, what do you think?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

Delphi 7 applications are ANSI and when using Unicode characters it is needed to have a Charset details to perform the conversion. But since there is no Charset defined for Vietnamese language the conversion fails and you get ? chars inplace of the character that failed to convert. I actually think that the ONLY way to be able to work with Vietnamese under Delphi 7 is to set Regional Options to Vietnamese on the PC where Delphi 7 is installed and set DEFAULT_CHARSET for Vietnamese language. Also if you converted the SIL file to UTF-8 please be sure to set StoreAsUTF8 property of TsiLang to True as well before loading the file under IDE.
Hope this helps.
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

Thank you for your reply

We are using TSilang 6.0.2, is there a StoreAsUTF8 property? I couldn't find it

Thanks
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

We downloaded the trial of the latest version and we did see this property, we set it to TRUE and then imported the specific language to the specific form but had the same problem.

The weird part is:
When using the SILEditor (not sure with what delphi version it was compiled) we had to use Convert to UTF8 in order to see the Vietnamese, meaning the SILEditor had the same problem that UTF8 solved, so we wonder why it doesn't work when importing it into the IDE

In order to import, we imported ONLY the Vietnamese and ONLY to that form where the TSILang object was as UTF8 but it didn't work, maybe there is another way to do it? notice that there were other languages for this component that were stored previously without UTF8
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

SIL Editor is Unicode application and this is why when you store Vietnamese as UTF8 it is able to convert and display it. Since conversion from UTF-8 to Unicode is performed without any additional information.
Delphi 7 is ANSI application as well as its VCL, this is why it will use defined (or default) charset for conversion from Unicode to ANSI.
Did you setup "Language for non-Unicode programs" option to Vietnamese and define Default_Charset from Vietnamese language?
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

Yes, we defined Vietnam and Vietnamese wherever possible in regional settings but we keep getting
tiếng Việt
instead of
tiếng Việt
once we import the SIL file into the IDE

I guess we have no way of seeing Vietnamese with Delphi 7
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

tiếng Việt
is looking very much like UTF8 text not converted to the actual string.
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

Which either strengthen your point regarding the missing charset or means that we are missing something

It's more likely that your charset theory is the right one
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Please try the following:
1. Create new project
2. Place TsiLang on form and define Vietnamese language there.
3. Set StoreAsUTF8=True.
4. Set Default_Charset for Vietnamese
5. Open Translation Editor and paste into Vietnamese item any value from SIL Editor using Windows clipboard.
6. Save the Translation Editor and open it again.
7. Check the content of Vietnamese.
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

We tried that already

We either had ? when Vietnamese was not the language of the computer or tiếng Việt when it was...

As you explained, it's as if Delphi fails to do the conversion
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

I'm sorry, but are you sure that when you copy using Windows Clipboard tiếng Việt from SIL Editor into Translations Editor you get tiếng Việt
Best regards,
Igor Siticov.
amos
Posts: 13
Joined: Thu Apr 28, 2011 2:42 pm

Post by amos »

Apparently it's even worse
I get ? instead of the characters when pasting, when I load language for Vietnamese I get the tiếng Việt
Post Reply