Re: RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Michael Van Canneyt



On Tue, 10 Jul 2012, Ludo Brands wrote:


Because the old behaviour is not buggy.

It simply did not support Unicode, and does the next best thing,
in casu: it transforms to the system codepage.

A car without ABS and SAT-Nav is not buggy.
It just doesn't support features which are nowadays called
standard. You can perfectly drive it.



An old car without a seat belt is buggy although when it was built seat
belts where not standard.


I still wouldn't call the car buggy. 
For me a car must be able to drive. That is its essential function.

If it doesn't start, or stops every 5 minutes, then it is buggy.
All the rest are options. Whether they are legally required or 
not is irrelevant to the car-ness of the car.


But I drive a motorcycle, so the point is moot ;-)




Just as Unicode is nowadays standard, N years ago, it was not.

Since backwards compatibility is very important, we must
offer the option.


The Json standard specifies unicode. Why have utf8 default off?


For backwards compatibility by default.


Old cars are retro-fitted with seat belts. Why sell new cars with seat belts
as an option?


So you'd reverse the constructor boolean argument to specify Utf8 as default, 
and let the user choose the old behaviour if he needs it ?


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Ludo Brands
 So you'd reverse the constructor boolean argument to specify 
 Utf8 as default, 
 and let the user choose the old behaviour if he needs it ?
 
If that is unthinkable then define new contructors
TJSONParser.Create2(...,AUseUTF8 : Boolean = True) or Create2(...,AUseUTF8 :
Boolean = True) and mark the Create(...) as deprecated. Or deprecate
TJSONParser and make it a descendant of TJSONParser2 that has
Create(...,AUseUTF8 : Boolean = True) constructors.

Ludo

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Michael Van Canneyt



On Tue, 10 Jul 2012, Ludo Brands wrote:


So you'd reverse the constructor boolean argument to specify
Utf8 as default,
and let the user choose the old behaviour if he needs it ?


If that is unthinkable then define new contructors
TJSONParser.Create2(...,AUseUTF8 : Boolean = True) or Create2(...,AUseUTF8 :
Boolean = True) and mark the Create(...) as deprecated. Or deprecate
TJSONParser and make it a descendant of TJSONParser2 that has
Create(...,AUseUTF8 : Boolean = True) constructors.


Nothing is unthinkable. The other constructs are very ugly.

I reversed the argument default value to True. UTF8 is now the default.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE : RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Ludo Brands

 Nothing is unthinkable. The other constructs are very ugly.
 
 I reversed the argument default value to True. UTF8 is now 
 the default.
 

A very wise decision;)

Ludo

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Michael Van Canneyt



On Tue, 10 Jul 2012, Ludo Brands wrote:




Nothing is unthinkable. The other constructs are very ugly.

I reversed the argument default value to True. UTF8 is now
the default.



A very wise decision;)


I must be getting older :)

Seriously: when json support was written, Unicode/UTF8 support in FPC was 
sketchy at best.
It makes sense to change it, but backward compatibility must be preserved as 
much as possible.

I have added a section to

http://wiki.freepascal.org/index.php?title=User_Changes_Trunk

to notify people of this change.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Jonas Maebe

On 10 Jul 2012, at 11:40, Michael Van Canneyt wrote:

 I have added a section to
 
 http://wiki.freepascal.org/index.php?title=User_Changes_Trunk
 
 to notify people of this change.

Could you change it to use the same format/template as the other entries?


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: RE : RE : RE : RE : [fpc-pascal] JSON and UTF8

2012-07-10 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
 
  http://wiki.freepascal.org/index.php?title=User_Changes_Trunk
 
  to notify people of this change.
 
  Could you change it to use the same format/template as the other entries?
 
 We can always trust Jonas to notice such things :-)
 
 Done.

Jonas remark reminded me of something else. Delphi uses TEncoding
everywhere as parameter (specially load/savetofile/stream like methods) to 
select codepage. Maybe do that too here?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal