I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

September Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Object PASCAL Topic   Print This     

How to fully support all locale settings?

How to fully support all locale settings? in Delphi Object PASCAL topic (part of our Pascal and Delphi Coding group).

Quick Search: support   settings   How fully   How fully support   all locale  
hyp3n0zy5
I have a program that does a lot with strings, and is required to work everywhere in the world, so also in Asia for example. What is the way to do this in Delphi? Only use the Ansi... string functions? If i understand correctly the default string type should support this. If i write code like

var SomeString: string;
SomeChar: char;
begin
if SomeString[1] = SomeChar then blabla
Does this work in other locales? If not how to do this? Confused How do i get the length of a string (in characters)?

If i understand correctly the only reason Delphi is not 100% unicode is because it would break Win9x compatibility. Please go ahead Borland! I don't want to worry about this crap...
 Posted 14 years ago (Thread Starter)
Comment Quote
About hyp3n0zy5 -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #11218, 2 replies
Thread Started 9/13/2005 1:08:00 AM
View Counter=4333
Last Reply Posted 9/14/2005 3:27:00 PM)
Location= 
Joined=18 years ago   MB Posts=21  
William Pantoja
Woodinville, WA, USA
Delphi supports localization and internationalization. WideString, WideChar, and PWideChar types support unicode. In addition, mode controls support localization and internationalization as well.

Keep in mind, things like your example above would not be practical as the character you are looking for may change from language to language.

Consult the documentation for further information as to the extent of support.

---
William Pantoja

Consultant/Software Engineer
ForceOne Technologies, Inc.

 Posted 14 years ago
Comment Quote
About William Pantoja -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #11219 (Level 1.1)  Reply to 11218
Thread Started 9/13/2005 1:34:00 AM
View Counter=2
Location=Woodinville, WA, USA  
Joined=18 years ago   MB Posts=163   KB Posts=1  
Most Recent Post
Joshua Delahunty
Prestwood IT
Citrus Heights, CA

Originally posted by hypenozys:

I have a program that does a lot with strings, and is required to work everywhere in the world, so also in Asia for example. What is the way to do this in Delphi? Only use the Ansi... string functions? If i understand correctly the default string type should support this. If i write code like

var SomeString: string;
SomeChar: char;
begin
if SomeString[1] = SomeChar then blabla
Does this work in other locales? If not how to do this? Confused How do i get the length of a string (in characters)?

If i understand correctly the only reason Delphi is not 100% unicode is because it would break Win9x compatibility. Please go ahead Borland! I don't want to worry about this crap...


"What is the way to do this in Delphi? Only use the Ansi... string functions? If i understand correctly the default string type should support this."

The Ansi functions are NOT the way you want to do things. That only supports the 256 characters of the current codeset on the computer.

What you may understand is that the String type is actually recast as either AnsiString or WideString (AnsiString by default) depending on compiler settings, and so can be switched at the compiler level. You have to code carefully to make sure that switching back and forth works correctly.

What you want to do (from what I gather you're asking) is to stick with WideString and its functions, so that you always work in Unicode. That will allow all text to work globally.

"How do i get the length of a string (in characters)?"

use Length(), either way you go.

"If i understand correctly the only reason Delphi is not 100% unicode is because it would break Win9x compatibility. Please go ahead Borland! I don't want to worry about this crap... "

Borland doesn't do it because it would be very time consuming and expensive, with little payback. .NET already handles this, so if you want to use Delphi, you use Delphi for .NET, and you've got the future covered.

Delphi for Win32 is very Unicode compliant, however. To go the extra mile, I suggest the TNT Unicode controls at http://www.tntware.com/delphicontrols/unicode/
I've used them myself, and they work great.

-- joshua

Joshua Delahunty
Prestwood Software
Senior Software Engineer
http://www.prestwood.com
 Posted 14 years ago
Comment Quote
About Joshua Delahunty -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Joshua Delahunty
I am a software engineer with many years professional experience, using everything from 6809 assembly language to C, C++, Delphi, Paradox for Windows, and Borland JBuilder.

Post ID #11227 (Level 1.2)  Reply to 11218
Reply Posted 9/14/2005 3:27:00 PM
Location=Citrus Heights, CA  
Joined=15 years ago   MB Posts=16   KB Posts=22   KB Comments=1  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1151A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #11218 Counter
4333
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech