Currently, CoolPrj isn't fully UNICODE aware.
Bugs: #285
Bugs: #536
Discussion: CoolEdit issues
Discussion: CoolEdit issues
Discussion: CoolEdit and C++Builder
Discussion: CoolEdit and C++Builder
Discussion: CoolEdit and C++Builder
Discussion: CoolEdit and C++Builder
Discussion: CoolEdit and C++Builder
Feature Requests: #266
Feature Requests: #267
Feature Requests: #54
News: 2022/07/owlmaker-build-6160-update
Wiki: Frequently_Asked_Questions
Wiki: OWLNext_Roadmap_and_Prereleases
Wiki: OWLNext_modules_description
Anonymous
We need to add a member variable 'encodingType' to TCoolFileBuffer.
When opening a file we must detect the encoding type, when reading the text file the appropiate conversion will be done:
When saving the file, the encoding must be preserved, so previous to save the first line the BOM will be saved (in case of non-ANSI files), and then again convert from native charset to the requested by the original file.
Hi Sebastian,
If your work on this is specific to 6.44, and it would be cumbersome for you to work on the trunk (7.1), then note that you can create a feature branch for this work, e.g. "branches/coolprj-unicode", by copying the current release branch for 6.44. Then when done, we can merge your changes into the trunk, and if appropriate, into the release branches. The feature branch can then be removed, if no longer needed.
My initial intention it's to support C++Builder both in 6.44.x and 7.x (as I have the long term target to migrate to OWLNext 7).
After I have coolprj running I will be able to work in UNICODE support.
@sebas_ledesma wrote:
Makes sense. I suggest "Encoding" as the member name. Member names should have leading capital letter (see our Coding Standards).
Makes sense. Perhaps there should be an option to select encoding in the save dialog, as in Notepad? If not, what would be the encoding for new files?
Good. Then I suggest you work on the trunk, and when done, we'll merge your work to the release branches in preparation for the next releases. However, if you feel it would be helpful to have a feature branch for working on 6.44, let me know if you need help to set it up (if you have TortoiseSVN installed, it is simply a copy in the Repository Browser).
Related
Wiki: Coding_Standards
I've migrated my code to UNICODE 5+ years ago,
One of our applications, it's a script editor (for adds and music schedulling) that uses text files.
So, I've developed a couple a functions to detect/write BOM and get/put lines with the corresponding encoding.
For the UNICODE version I've silently switched to UTF-16 when saving. But for OWLMaker or other user application, the GUI should have an option to select the encoding.
In discussion:
https://sourceforge.net/p/owlnext/discussion/97175/thread/8cbc674381/?limit=100#7630
@sebas_ledesma wrote:
I've done a quick code review. First, the important stuff:
Second, some suggestions on coding style:
Finally, a few suggestions and some nitpicking:
Last edit: Vidar Hasfjord 2026-04-14
TEncoding should belong to the owl namespace, or at least to coolproj namespace.
Explanation: the developer will need to know/access to that value and implement the user inteface to allow to the user to select a different encoding when saving a file.
Also this will allow to implement the same mechanism to the TEditFile class.
At last but not least. eAnsi should value 0, as it's our default value.
I'm not sure to assign 1,2,3 to the others "eOptions" or instead use the very same BOM as value.
@sebas_ledesma wrote:
Makes sense. My code example was just for exposition. I propose nesting TEncoding within TCoolTextBuffer (similar to TCoolTextBuffer::TCrLfStyle). I guess it is within TCoolTextBuffer that you need to extend the API with encoding support.
Makes much sense.
PS: By the way, I've attached full code in my previous post. It has error handling and further refactoring for code reuse (conversion functions now only used at a single call site within helper functions, which are fully reused). Though, beware, it is not tested in any way.
Here it's a sample code of writeBOM.
Traditionally, text file were 'headerless'. Now in the UNICODE world a couple of bytes at the beggining indicate the Byte Order Mask.
For those living in DOS / Windows world, the omission means ANSI, but for those from Mac / Android, the omission normally means UTF-8.
Last edit: Sebastian Ledesma 2022-01-10
Here it's my code to write text with unicode support.
Note: TCoolFileBuffer::Load uses file handles instead of "FILE * "
Also, it load into memory buffer and segments the text into lines.
So, the updated code will be similar.
In discussion:
https://sourceforge.net/p/owlnext/discussion/97175/thread/8cbc674381/#786e
@sebas_ledesma wrote:
Great work, Sebastian, and thanks for the comprehensive log messages! A good log makes it easier to review development work. Regarding the delete-bug [r5719], I've created a dedicated ticket [bugs:#511], and updated your log message, adding a reference. Note that another instance of this issue remains for SyntaxArray in TCoolTextBuffer::SetSyntaxArray, where SyntaxArray is still deallocated using plain delete. I've added a comment in the log message about this.
I notice that you have (accidentally) committed your changes to the 7.0 release branch.
Note: Please do not change our release branches! That should be done by release managers only.
Remember, development work should ideally be performed on the trunk. Here is the correct checkout address for the trunk (you can use the SVN command "svn switch" to flip your working copy to the trunk):
Accordingly, I have moved your work to the trunk and restored the 7.0 release branch.
PS. If you cannot work on the trunk for some reason, or it is more practical for you to base your work on one of our existing releases, then you can create a temporary development branch, as mentioned earlier (let me know if you need help to set it up, but if you have TortoiseSVN installed, it is simply a copy in the Repository Browser).
Related
Bugs: #511
Commit: [r5719]
Feature Requests: #54
I usually work on my copy of OWL6.44. I've created a copy of 'Trunk' to update it but it seems that I've used the OWLNext 7 link instead.
Thanks.
Last edit: Sebastian Ledesma 2022-01-10
No problem! If it would be easier for you, we can set up a development branch based on 6.44. Just let me know if need help to do so.
Quick code review:
Here is some (untested) modern C++ for writing the BOM:
PS: Cool to see that the switch-statement leads to better optimisation than hand-coded lookup. The compiler is really good at switch-statements! See: https://godbolt.org/z/7GaGrv19z
Last edit: Vidar Hasfjord 2026-04-14
Pleas note that [r5725] respect the internal usage of 'text' as an array of characters without consider zero ending. However the documentation about CF_TEXT indicates that the zero ending it's used. I keeped the CoolEdit usage to avoid breaking some internal mechanism and i will review later with more time (and knowledge about cooledit internals)
https://docs.microsoft.com/en-us/windows/win32/dataxchg/standard-clipboard-formats
Related
Commit: [r5725]
Hi Sebastian, good work on fixing Unicode issues and more in CoolPrj!
Regarding your log messages, note that the tag "BUG" is short for "bugfix" (so no need to say "fix for bug"), and our current coding style is to just use the bug ticket title as the primary log message, with the ticket reference at the end. See Coding Standards.
Not a big deal, but I've cleaned up your log messages, ticket titles and descriptions a little. Hope you don't mind!
Hi Vidar:
Can you delete 'Feature request #189'?
I've accidentally entered feature instead of a bug.
BTW: I've reviewd the report of PVS (https://www.fly-server.ru/pvs-studio/owlnext/) and I've found some interesting points that complement my reviewing.
Done.
Super! If you fix issues mentioned in that report, it would be helpful if you update the associated ticket [bugs:#504], so that it is clear which issues have been addressed.
Related
Bugs: #504
One point to keep in mind.
In OWLNext 6.44 the font used in CoolEdit it's 'Courier New', in OWLNext 7.x it's "Consolas", in both cases to 'fully' support UNICODE the font family must include the glyphs for others alphabets, like arabic, cyrillic, hebrew, thai, etc.
In other cases the font subsytem will draw a square block when it has a character that cannot draw.
So far, [r5740] , all the changes / bugfixes are API and ABI compatibles and can be transtated to 6.44.
But I'm thinking of extending the coolprj API to allow change/save the file with another Enconding, and that will means the creating of branch 6.45.
Related
Commit: [r5740]
Hi Sebastian,
Setting up a branch for 6.45 and extending the API is not a big deal. If you want to do that, I can help. However, the important issue you should consider is whether you are prepared to support your extensions publicly, including repairing any regressions. Notably, the 6.40 series has support for a lot of old compilers, and you would then ideally have to make sure your code works with all of them.
That said, this issue applies to any compatible changes to 6.44 as well.
I would prefer to keep the 6.40 series stable now and do all new development on the 7 series. Personally, I am only prepared to maintain code with the latest compilers (although I still have Borland C++ 5.02 and 5.5 installed for the occasional regression testing), and I want to do minimal maintenance and administrative work on old OWLNext versions.
What is the big obstacle stopping you from migrating to 7? If there are showstoppers in your personal circumstance that prevent you from migrating your code, remember that you can always keep your own custom branch of 6.44 with the extensions you want and need. You don't have to publish it, especially if there is no demand for it among the broader user base.
Personally, I have my own experimental branch Owlet, where I implement extensions I want and need for my software. Many of those have been merged into the OWLNext trunk, but many have not. That is my preferred approach.
There is another issue with adding new features in older versions — it blocks the upgrade path. If we publish 6.45 with new features, it blocks the upgrade path to 7.0 for you and any other users of the new features. This is an odd situation, where a lower version number has more features than a higher version. Of course, your extensions will be available in 7.1, but the latter is not yet ready for release, and may not be for some time.
For all mentioned reasons, I recommend you use a private branch to extend 6.44, if you really need to, and set the milestone for this feature ticket to 7.1.
Hi Sebastian,
Since we now have a regression in OWLMaker (missing filename in editor window title, as noted in discussion:8cbc674381), I suggest you add OWLMaker as one of your test cases as you work on this feature ticket and any related bug tickets.
Hopefully, the source revision causing the regression should be easy to identify. As I mentioned, the regression must have happened since revision 5699, which is the build number of the most recent release of OWLMaker.