I have lots of problem when trying to format units with non-ascii unicode characters under Delphi 2009. Many strings are treated as "unterminated strings". Try this string for example (contains arabic, chinese and japanese):
'English للغة العربية 中文 中文简体 ウェブ全体から検索'
The comment field is also affected, JCF tends to delete some of the statement after a comment field with some unicode characters, probably because of mistreating the end of string.
many thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to run jcfgui.exe under different windows (XP, vista, 2K, XPx64) with different system locale ("language for non-unicode programs") under vmware. If the system locale is in English, the result is correct. If the locale is in trad/simp Chinese or Japanese, the result will be wrong. The pas file is in UTF8 format.
2.43 also corrupted one of my unit (which i can't disclose the content of it) even JCF didn't return any error or access violation. Some of the operators or equal sign are gone or replaced by some random characters. I have to restore the unit from the backup to fix it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have lots of problem when trying to format units with non-ascii unicode characters under Delphi 2009. Many strings are treated as "unterminated strings". Try this string for example (contains arabic, chinese and japanese):
'English للغة العربية 中文 中文简体 ウェブ全体から検索'
The comment field is also affected, JCF tends to delete some of the statement after a comment field with some unicode characters, probably because of mistreating the end of string.
many thanks
This should work, and I'll have a look at this when I am able to. If you can post examples of units that are incorrectly parsed, that would help.
This seems to work for me. I have just checked in a file to test for it. The file can be formatted, even if the Ui doesn't display it correctly.
Are you formatting files or using the IDE plug-in? Do you know the content encoding of the file? Do you have a sample file that fails?
Thanks
Anthony Steele
Thx for the reply.
I tried to run jcfgui.exe under different windows (XP, vista, 2K, XPx64) with different system locale ("language for non-unicode programs") under vmware. If the system locale is in English, the result is correct. If the locale is in trad/simp Chinese or Japanese, the result will be wrong. The pas file is in UTF8 format.
Another problem I came across a few days ago:
procedure MyGetFileVersionInfo(const AFilename: UnicodeString; AStringList: {$IFDEF UNICODE}TStrings{$ELSE}TTntStrings{$ENDIF});
The above delcaration compiles fine but JCF returns : Exception TEParseError Unexpected token, expected ")"
I am using JCF2.42.
Thanks
Alan Chan
I have done some fixes and tests on UTF8 files. This will be in the next release.
But I can't tell if this fixes your issue - do you have a sample file that shows the error?
For the $IFDEF issue, go to the Settings, ASM tab, and check "Enable preprocessor parsing"
otherwise $IFDEF are ignored and the resulting syntax in this case is not parsable.
I've tried 2.43 and ran into the same exact problem as before, here is a simple test file.
http://www.hkpcug.org/personal/akirabbq/temp/test.zip
2.43 also corrupted one of my unit (which i can't disclose the content of it) even JCF didn't return any error or access violation. Some of the operators or equal sign are gone or replaced by some random characters. I have to restore the unit from the backup to fix it.
Which UI are you using? I can see a display issue with your test on the notepad UI, but only in Delphi 2007.
I am using Delphi 2009 and the jcf IDE plugin.
Here is the error msg under the IDE when formatting the test.pas :
[12F0F4D2]{JCFIdeD12.bpl} Buildtokenlist.TBuildTokenList.TryLiteralString + $DE
[12F0ED0C]{JCFIdeD12.bpl} Buildtokenlist.TBuildTokenList.SetSourceCode + $B8
[12F0EE49]{JCFIdeD12.bpl} Buildtokenlist.TBuildTokenList.GetNextToken + $3D
[12F102DB]{JCFIdeD12.bpl} Buildtokenlist.TBuildTokenList.EndOfFile + $F
[12F10125]{JCFIdeD12.bpl} Buildtokenlist.TBuildTokenList.BuildTokenList + $45
[12F3D7B3]{JCFIdeD12.bpl} Converter.TConverter.Convert + $6B
[12F3E973]{JCFIdeD12.bpl} Editorconverter.TEditorConverter.Convert + $EF
[12F4F003]{JCFIdeD12.bpl} Jcfidemain.TJcfIdeMain.ConvertEditor + $3B
[12F4EF59]{JCFIdeD12.bpl} Jcfidemain.TJcfIdeMain.DoFormatCurrentIDEWindow + $85
[12F506F4]{JCFIdeD12.bpl} Delay.Finalization + $C14
[207A369F]{coreide120.bpl} VClient.KeyBindingProc (Line 2678, "VClient.pas" + 10) + $14
[500576D9]{rtl120.bpl } Classes.TComponent.UpdateAction (Line 11901, "Classes.pas" + 1) + $6
[501F5C66]{vcl120.bpl } Forms.ProcessUpdate (Line 6713, "Forms.pas" + 1) + $13
[50006DDA]{rtl120.bpl } System.@IsClass (Line 10084, "System.pas" + 1) + $8
[501F5CD4]{vcl120.bpl } Forms.TraverseClients3 (Line 6730, "Forms.pas" + 5) + $1E
[501F5CEE]{vcl120.bpl } Forms.TraverseClients3 (Line 6730, "Forms.pas" + 5) + $38
[207E0BB8]{coreide120.bpl} KbClient.TIDEKBDFrameAPI.MapAndEvalInternal (Line 842, "KbClient.pas" + 10) + $11
[207E063D]{coreide120.bpl} KbClient.HandleKey (Line 572, "KbClient.pas" + 6) + $12
[207E0A72]{coreide120.bpl} KbClient.TIDEKBDFrameAPI.ProcessKeyStroke (Line 785, "KbClient.pas" + 203) + $1
[501F5CDF]{vcl120.bpl } Forms.TraverseClients3 (Line 6730, "Forms.pas" + 5) + $29
[501F5D46]{vcl120.bpl } Forms.TCustomForm.CMActionUpdate (Line 6752, "Forms.pas" + 11) + $21
[501D0C0E]{vcl120.bpl } Controls.TControl.WndProc (Line 6642, "Controls.pas" + 91) + $6
[501D3C12]{vcl120.bpl } Controls.TWinControl.GetControl (Line 8473, "Controls.pas" + 4) + $A
[50006DDA]{rtl120.bpl } System.@IsClass (Line 10084, "System.pas" + 1) + $8
[501F5CDF]{vcl120.bpl } Forms.TraverseClients3 (Line 6730, "Forms.pas" + 5) + $29
[501F5D46]{vcl120.bpl } Forms.TCustomForm.CMActionUpdate (Line 6752, "Forms.pas" + 11) + $21
[501D0C0E]{vcl120.bpl } Controls.TControl.WndProc (Line 6642, "Controls.pas" + 91) + $6
[501D529B]{vcl120.bpl } Controls.TWinControl.WndProc (Line 9336, "Controls.pas" + 136) + $6
[207E16DC]{coreide120.bpl} KbClient.TIDEKBDChildAPI.ProcessKeyStroke (Line 1369, "KbClient.pas" + 14) + $16
[207B7F88]{coreide120.bpl} EditorControl.TCustomEditControl.DoKeyDown (Line 7044, "EditorControl.pas" + 6) + $18
[207AE7B2]{coreide120.bpl} EditorControl.TCustomEditControl.CNKeyDown (Line 1966, "EditorControl.pas" + 17) + $4
[501D0C0E]{vcl120.bpl } Controls.TControl.WndProc (Line 6642, "Controls.pas" + 91) + $6
[501D0834]{vcl120.bpl } Controls.TControl.Perform (Line 6420, "Controls.pas" + 10) + $8
[501D529B]{vcl120.bpl } Controls.TWinControl.WndProc (Line 9336, "Controls.pas" + 136) + $6
[20B89C5E]{designide120.bpl} DeskUtil.SetFocusHook (Line 435, "DeskUtil.pas" + 4) + $C
[501D49B4]{vcl120.bpl } Controls.TWinControl.MainWndProc (Line 9065, "Controls.pas" + 3) + $6
[50058938]{rtl120.bpl } Classes.StdWndProc (Line 12723, "Classes.pas" + 8) + $0
[501F9C0C]{vcl120.bpl } Forms.TApplication.IsKeyMsg (Line 9523, "Forms.pas" + 25) + $12
[501F9CA6]{vcl120.bpl } Forms.TApplication.IsHintMsg (Line 9544, "Forms.pas" + 3) + $2
[501F9EA3]{vcl120.bpl } Forms.TApplication.ProcessMessage (Line 9607, "Forms.pas" + 17) + $31
[501F9F0A]{vcl120.bpl } Forms.TApplication.HandleMessage (Line 9643, "Forms.pas" + 1) + $4
[501FA235]{vcl120.bpl } Forms.TApplication.Run (Line 9780, "Forms.pas" + 26) + $3
[004259D2]{bds.exe } bds.bds (Line 196, "" + 7) + $7
Hm, it worked for me in Delphi 2009.
I guess it's because my jcl version, it's rather old I think. I am using the JCF Notepad right now, and it seems working without problem.
Thx for your help.
After installing the latest JCL/JVCL, the ide plugin still produces the "unterminated string" error or trashed some lines.
Here are the screenshots, notice line 27 & 28 are merged after formatting, and also some extra random characters (squares):
http://www.hkpcug.org/personal/akirabbq/temp/Image1.png
http://www.hkpcug.org/personal/akirabbq/temp/Image2.png
The third one is test.pas as above:
http://www.hkpcug.org/personal/akirabbq/temp/Image3.png
I think i have to stick with JCFGUI from now on.... I really missed pressing ctrl-alt-f under the IDE since delphi 3. :(