Comments (15)
This comment was originally written by @ahmetaa
I think without proper Locale (is there any?) settings 'I' cannot be converted to 'ı'.
from sdk.
This comment was originally written by [email protected]
String.toLowerCase/toUpperCase will not be locale aware. The plan (which I do not personally agree with) is to provide a separate i18n library that has basically the important functionality of ICU (TBD).
Added WontFix label.
from sdk.
This comment was originally written by @mdakin
So in order to make Dart applications that use Strings properly in Turkish (and Azeri etc.), programmers will have to use an external library? This is a huge disappointment.
from sdk.
This comment was originally written by @ahmetaa
If it is well documented, I guess it is o.k. Otherwise it would cause subtle bugs.
from sdk.
This comment was originally written by @mdakin
So in order to make Dart applications that use Strings properly in Turkish (and Azeri etc.), programmers will have to use an external library? This is a huge disappointment.
from sdk.
This comment was originally written by [email protected]
The i18n library will be provided, but you will have to #import it, and use its methods rather than the ones on String.
from sdk.
This comment was originally written by [email protected]
I agree personally - I think it would be better to leave off toLowerCase/toUpperCase from String than to provide one that produces unexpected behavior for non-ASCII characters and incorrect behavior in some locales even for ASCII characters, and we should be learning from i18n mistakes in Java and elsewhere rather than repeating them.
from sdk.
This comment was originally written by [email protected]
If plan for Dart is to use an external library to support basic string case operations for Turkic languages with latin script, will it look like this: (lets assume an application that gets username and lowercases it before processing it further, a common use case)
name = get Name
locale = Get Users locale
if locale uses non Ascii Latin script
normalized = i18n.toLowerCase(name, locale)
else
normalized = name.toLowerCase()
I don't expect anybody to write code like this to convert cases, and as a result most applications written will be automatically broken for several Turkic languages.
I actually reported same error for go, http://code.google.com/p/go/issues/detail?id=703 they ended up adding toLowerSpecial and toUpperSpecial methods to Strings package (http://code.google.com/p/go/source/detail?r=477b3015c0 ) However I am not sure this solution is any better.
Would you consider reopening the bug, maybe in a different form? What can we do to fix this problem?
from sdk.
This comment was originally written by [email protected]
Personally, I agree with you, but I think it is going to take more than a few people to change this plan, as the VM guys do not want to have to bundle something like ICU into the VM, as that would preclude implementation on very small platforms. Personally, I think any program that doesn't consider localization is broken at this day and age, and it shouldn't even be possible to write one that doesn't.
Regarding your example, the expectation is that anyone who does care about writing internationalized apps will always use the i18n library and not use String.toLowercase/toUpperCase, so it would look something like this:
normalized = I18n.toLowerCase(name);
There is work to be done on how locales are specified (on the browser it will almost certainly be just one locale at a time by default, the server gets a little messier but by default one locale per request), but the idea is if you care about localization you always use the localizable API.
from sdk.
Added Area-Library label.
from sdk.
This comment was originally written by @mdakin
jat@, then, as you said before, maybe the safest path is to remove toLowerCase and toUpperCase methods from String class.
Would Dart team consider removing "WontFix" status for this bug?
from sdk.
This comment was originally written by [email protected]
Set owner to @floitschG.
Added Area-Language label.
from sdk.
This comment was originally written by @mdakin
After thinking about it, I have one last comment on this,
If toLowerCase and toUpperCase are by default locale sensitive, this would introduce a new class of terrible bugs, as Turkish case conversion i <-> İ and ı <-> I converts normal Ascii strings into non-Ascii and this breaks other things like URLs, database column names etc. Java's default locale sensitive case conversion approach caused tons of issues , most applications stopped working on Turkish locale.
The best scenario, as you already mentioned, would be providing both locale sensitive and insensitive case converson methods in a separate core library.
from sdk.
The core Dart language avoids Unicode as much as possible. It has toLower/UpperCase but not much more.
toLowerCase and toUpperCase are using Unicode's (locale independent) lower and uppercase mappings (see first and fifth question at http://unicode.org/faq/casemap_charprop.html)
String.compareTo uses the unicode charCode and is hence locale independent, too.
As John said: for i18n support one will need to import the i18n library and not use the toLower/UpperCase functions for locale dependent strings.
Hopefully this will be as automatic as importing the html-library.
from sdk.
This comment was originally written by @ahmetaa
Just to add some info,
There is a pub package for this now: http://pub.dartlang.org/packages/dotless_i
Also another issue is opened: https://code.google.com/p/dart/issues/detail?id=12721
from sdk.
Related Issues (20)
- [native assets] Use `AddDllDirectory` on native assets dir(s) to enable dynamic linking HOT 2
- Analyzer does not navigate up in the directory tree looking for closest analysis_options.yaml file HOT 2
- Has 3.5.1 sdk been submitted to Docker? HOT 3
- Expression evaluation returns an error when trying to use extension inside aliased import HOT 4
- Error handling for expression evaluation throws with the wrong class HOT 3
- Failures on [ DAP ] Migrate DAP to launch DDS with DartDevelopmentServiceLauncher HOT 2
- Failures on [ DAP ] Migrate DAP to launch DDS with DartDevelopmentServiceLauncher
- Encapsulate field assist miss-types the constructor field if the type is from an aliased import HOT 1
- Encapsulate field assist doesn't move override annotations HOT 1
- [Macro] [Analyzer] [Error] [Invalid argument(s): Unresolved identifier: int HOT 7
- An unexpected error was encountered by the Analysis Server. HOT 1
- Analyzer `--fatal-infos` flag issues HOT 2
- [analyzer] Provide a `ResourceProvider` that takes a `FileSystem` from the file package HOT 8
- Build issue with js_interop `isA` HOT 2
- Mark `dartExecutable` parameter as `required` in `DartDevelopmentServiceLauncher.start` HOT 1
- `_NativeSocket.startConnect` is possibly throwing `SocketException`s that cannot be caught with `try` HOT 7
- [wildcards] Semantic Highlighting - consider styling wildcards HOT 9
- Dart vm `RegExp` doesn't seem to properly match all emojis HOT 2
- [analyzer] how do i get middle of prefix value type? HOT 1
- dart fix --apply throws an error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.