View Issue Details

IDProjectCategoryView StatusLast Update
0023715LazarusIDEpublic2014-11-06 13:49
ReporterJulio Jiménez BorregueroAssigned ToJesus Reyes 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version1.1 (SVN)Product Build 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0023715: JCF failure
DescriptionCode can't be reformatted probably due UTF8 chars in a string (more than two utf8 chars).
Steps To ReproduceCreate a new Application Project
Add a button to the form
Add code to the click button event:
procedure TForm1.Button1Click(Sender: TObject);
var
  resp: integer;
begin
  resp := Application.MessageBox(pchar('¿áñ?'), 'Confirme', MB_ABORTRETRYIGNORE +
    MB_ICONQUESTION);
end;

Press Ctrl+D to reformat the code


You'll get:

JCF: unit1.pas Exception Exception Spaces to end is -1 on ; at on line 36 position 98 line is
  resp := Application.MessageBox('¿áñ?', 'Confirme', MB_ABORTRETRYIGNORE + MB_ICONQUESTION);
JCF: IDE Aborted due to error

If you remove one of UTF8 chars, all is fine (¿, á or ñ)
TagsNo tags attached.
Fixed in Revision46756
LazTarget1.4
Widgetset
Attached Files

Relationships

related to 0023525 closedJuha Manninen Patches JEDI Code Format does not support Chinese 
related to 0023442 resolvedJuha Manninen Lazarus Using JEDI Code Format on MacOS (Widestrings and Ansistrings) 
has duplicate 0024554 feedbackJesus Reyes Lazarus Format file do not work well in unit with Chinese character 

Activities

Juha Manninen

2013-01-21 19:21

developer   ~0065062

Example code, please.

Julio Jiménez Borreguero

2013-01-21 20:14

reporter   ~0065065

Last edited: 2013-01-21 20:15

Check steps to reproduce... (advanced view)

I'll paste here too

Create a new Application Project
Add a button to the form
Add code to the click button event:
procedure TForm1.Button1Click(Sender: TObject);
var
  resp: integer;
begin
  resp := Application.MessageBox('¿áñ?', 'Confirme', MB_ABORTRETRYIGNORE +
    MB_ICONQUESTION);
end;

Press Ctrl+D to reformat the code


You'll get:

JCF: unit1.pas Exception Exception Spaces to end is -1 on ; at on line 36 position 98 line is
  resp := Application.MessageBox('¿áñ?', 'Confirme', MB_ABORTRETRYIGNORE + MB_ICONQUESTION);
JCF: IDE Aborted due to error

If you remove one of UTF8 chars, all is fine (¿, á or ñ)

Juha Manninen

2013-01-21 20:44

developer   ~0065066

Sorry, I forgot to click "View Advanced" again.
I cannot reproduce. Please try with latest trunk.

Julio Jiménez Borreguero

2013-01-21 20:53

reporter   ~0065067

I use latest trunk:

Revisión del último cambio: 39929
Fecha de último cambio: 2013-01-21 19:18:44 +0100 (lun 21 de ene de 2013)


I attach the example project... I forgot to say, using Linux/GTK2 i386 + fpc 2.6.0

2013-01-21 20:53

 

test-jcf.7z (60,365 bytes)

Juha Manninen

2013-01-21 23:16

developer   ~0065069

Strange. I get a little different problem when doing "Jedi Code Format" -> "All files in project".
Then a message says that Unit1.pas was changed in file system. After reloading, UTF8 chars have changed to questions marks.
This happens only sometimes, not always.
The files were open only in Lazarus.

Julio Jiménez Borreguero

2013-01-22 09:55

reporter   ~0065070

Last edited: 2013-01-22 09:56

I also get a warning reformatting all files in project it asks me to reload or ignore.. I press Ignore and only did a change in the example prj file (true changed to True) then fires the same error in unit1.pas

Another tip. In the sentence 'resp:= Application.MessageBox.....' if I remove the 'resp:=' then jcf reformats ok.

If I replace the 'resp:= Application.....' for 'if Application.........' then all is fine too. Weird!

If I change the var name for 'r' all is fine too so it seems there is something wrong with lengths.

I also tried:

  with Application do
  begin
    resp := MessageBox('¿áñ?', 'Confirme', MB_ABORTRETRYIGNORE + MB_ICONQUESTION);
  end;

and is ok too

I can reproduce it every time in different computers, all Linux i386 + Gtk2 and also Lazarus compiled for QT

Xubuntu 12.10, Debian Sid, Mate Desktop, Xubuntu.

I don't know what to add... I can reproduce every time as I said.. and this isn't a new bug; has been here for ages.. but never reported it.

For a workaround I'll do 'with Application do......' but the issue is there.

Jesus Reyes

2013-01-24 21:25

developer   ~0065144

Last edited: 2013-01-24 21:53

Confirmed, reproduced every time. <stroke>It seems jcf is not aware of UTF8 strings on code.</stroke> Well, it seems it is aware.

Jesus Reyes

2014-11-05 01:17

developer   ~0078905

Please, test.

Julio Jiménez Borreguero

2014-11-05 10:59

reporter   ~0078913

Test OK. Thank you.

Issue History

Date Modified Username Field Change
2013-01-21 18:19 Julio Jiménez Borreguero New Issue
2013-01-21 19:21 Juha Manninen LazTarget => -
2013-01-21 19:21 Juha Manninen Note Added: 0065062
2013-01-21 19:21 Juha Manninen Status new => feedback
2013-01-21 20:14 Julio Jiménez Borreguero Note Added: 0065065
2013-01-21 20:15 Julio Jiménez Borreguero Note Edited: 0065065
2013-01-21 20:42 Juha Manninen Relationship added related to 0023525
2013-01-21 20:42 Juha Manninen Relationship added related to 0023442
2013-01-21 20:44 Juha Manninen Note Added: 0065066
2013-01-21 20:53 Julio Jiménez Borreguero Note Added: 0065067
2013-01-21 20:53 Julio Jiménez Borreguero File Added: test-jcf.7z
2013-01-21 23:16 Juha Manninen Note Added: 0065069
2013-01-22 09:55 Julio Jiménez Borreguero Note Added: 0065070
2013-01-22 09:56 Julio Jiménez Borreguero Note Edited: 0065070
2013-01-24 21:25 Jesus Reyes Note Added: 0065144
2013-01-24 21:25 Jesus Reyes Status feedback => confirmed
2013-01-24 21:53 Jesus Reyes Note Edited: 0065144
2013-06-07 13:04 Martin Friebe Relationship added has duplicate 0024554
2014-11-05 01:10 Jesus Reyes Assigned To => Jesus Reyes
2014-11-05 01:10 Jesus Reyes Status confirmed => assigned
2014-11-05 01:17 Jesus Reyes Fixed in Revision => 46756
2014-11-05 01:17 Jesus Reyes LazTarget - => 1.4
2014-11-05 01:17 Jesus Reyes Note Added: 0078905
2014-11-05 01:17 Jesus Reyes Status assigned => resolved
2014-11-05 01:17 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-11-05 01:17 Jesus Reyes Resolution open => fixed
2014-11-05 01:17 Jesus Reyes Target Version => 1.4
2014-11-05 10:59 Julio Jiménez Borreguero Note Added: 0078913
2014-11-06 13:49 Julio Jiménez Borreguero Status resolved => closed