Project

General

Profile

Support #9445

compatibility test FIX-CODEPAGE

Added by Greg Shah over 1 year ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Paul Bodale
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

Related issues

Related to Base Language - Bug #9532: codepage support in ASC(), CHR(), OUTPUT TO ... CONVERT and FIX-CODEPAGE() New

History

#1 Updated by Greg Shah over 1 year ago

  • Subject changed from compatibility test FIX-CODEPAGE() to compatibility test FIX-CODEPAGE

Check the FIX-CODEPAGE tests in Testcases to ensure they are complete and comprehensive. Add tests if needed. Convert and run the tests. Fix any issues as needed until the test pass completely.

#2 Updated by Alexandru Lungu over 1 year ago

  • Assignee set to Paul Bodale

#3 Updated by Paul Bodale over 1 year ago

  • Status changed from New to WIP
  • % Done changed from 0 to 40

#4 Updated by Paul Bodale over 1 year ago

There is currently only one test that is failing.

After I looked into it it appears that this is closely related to the CPINTERNAL session attribute. When the longchar variable is initialized, the codePage value is automatically set to the CPInternal value which is "1252". This seems to be the default option for running the converted code or could even be a mistake.

In progress, defining a variable longchar and initializing it will result (without calling FIX-CODEPAGE()) in the GET-CODEPAGE() call to return "ISO8859-1".

#5 Updated by Greg Shah over 1 year ago

ISO8859-1 is indeed the default codepage for OE. You use the -cpinternal option on the command line (or with similar options in a .pf or other configuration file like ubroker.properties) to override the default. The testing needs to be run with different cpinternal values to ensure it all works properly.

#6 Updated by Paul Bodale over 1 year ago

  • % Done changed from 40 to 100
  • Status changed from WIP to Review
  • reviewer Alexandru Lungu added

I modified the test which was failing to take into account the cpinternal startup parameter. Because in PROGRESS if we try to assign a codepage to a longchar which is not empty an error will be thrown but the codepage value will be the same as specified at the beginning of the program and this was reason for which the test was failing.

I added 2 more tests for a comprehensive coverage and also modified the structure of class CodepageFix so that each test has it's own method and for the class itself to be more clean and I tested will all the values of cpinternal found.

#7 Updated by Alexandru Lungu over 1 year ago

  • Status changed from Review to WIP
  • % Done changed from 100 to 50

There are some adjacent changes in the commit:

=== modified file 'udfs/udf.test.gen/.settings/org.eclipse.buildship.core.prefs'
--- old/udfs/udf.test.gen/.settings/org.eclipse.buildship.core.prefs    2021-09-21 18:09:52 +0000
+++ new/udfs/udf.test.gen/.settings/org.eclipse.buildship.core.prefs    2025-01-20 15:14:32 +0000
@@ -1,2 +1,13 @@
+arguments=--init-script /home/pbb/.config/Code/User/globalStorage/redhat.java/1.38.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle --init-script /home/pbb/.config/Code/User/globalStorage/redhat.java/1.38.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/protobuf/init.gradle
+auto.sync=false
+build.scans.enabled=false
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
 connection.project.dir=
 eclipse.preferences.version=1
+gradle.user.home=
+java.home=/usr/lib/jvm/java-17-openjdk-amd64
+jvm.arguments=
+offline.mode=false
+override.workspace.settings=true
+show.console.view=true
+show.executions.view=true

=== modified file 'udfs/udf.test.gen/.settings/org.eclipse.jdt.core.prefs'
--- old/udfs/udf.test.gen/.settings/org.eclipse.jdt.core.prefs    2021-11-15 19:20:05 +0000
+++ new/udfs/udf.test.gen/.settings/org.eclipse.jdt.core.prefs    2025-01-20 15:14:32 +0000
@@ -1,4 +1,7 @@
 eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false

=== modified file 'words/java/data-gen/tests/.project'
--- old/words/java/data-gen/tests/.project    2021-02-25 08:08:41 +0000
+++ new/words/java/data-gen/tests/.project    2025-01-20 15:14:32 +0000
@@ -14,4 +14,15 @@
     <natures>
         <nature>org.eclipse.jdt.core.javanature</nature>
     </natures>
+    <filteredResources>
+        <filter>
+            <id>1737039660994</id>
+            <name></name>
+            <type>30</type>
+            <matcher>
+                <id>org.eclipse.core.resources.regexFilterMatcher</id>
+                <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+            </matcher>
+        </filter>
+    </filteredResources>
 </projectDescription>
Otherwise, the approach provides some clarity to the tests.
I am looking at what FIX-CODEPAGE is supposed to to and there are some edges that may need some extra attention:
  • I think convmap.cp is quite standard so FWD should support all things from that. Most of the tested codepages seem to be utf-8 and iso8859-1. Can we have some test to approve all cp to be supported are actually supported?
  • Please test how this statement integrates with other statements like stated: COPY-LOB, OVERLAY and SUBSTRING. Take the extra mile and check GET-CODEPAGES, GET-CODEPAGE, IS-CODEPAGE-FIXED.
  • check that the codepage is case-insensitive.

#8 Updated by Paul Bodale over 1 year ago

  • Status changed from WIP to Review
  • % Done changed from 50 to 100

I have included tests for all the possible codepage values and even for the ones not yet supported by FWD.
As far as those tests go, there was only one specific codepage I found that it cannot be used for LONGCHAR (or CLOB) variables and that is "GB18030" . I modified the FWD's code so that the behavior will be the same as in PROGRESS where an error gets thrown if trying to assign this encoding to a LONGCHAR variable. For the rest of the supported encodings, all the tests passed.

Next, I've added a few tests to see how the FIX-CODEPAGE statement integrates with COPY-LOB, OVERLAY, SUBSTRING statements and the IS-CODEPAGE-FIXED function. I have to mention that these tests are not comprehensive as I only wanted to minimally test how those statements combine together and if one correctly affects the other. To be 100% sure that those statements behave the same as in progress, a lot more tests need to be written but I assume that those are not included in the scope of this task.
As far as those tests go, I haven't found any problem and everything seems to be working smoothly.

I also added some tests to check if the FIX-CODEPAGE is case-insensitive in FWD. From what I found it looks like this works solely based on the fact that the GET-CODEPAGE returns a CHARACTER type and in progress a variable containing "abc" is equal another variable containing "ABC".

One small thing to note is that there is a weird behavior I noticed in PROGRESS with the following encodings for the OVERLAY and SUBSTRING statements:
  • UTF-16
  • UTF-16LE
  • UTF-16BE
  • UTF-32
  • UTF-32LE
  • UTF-32BE

For variables with this encodings, the statements return wrong results. For UTF-32BE I even encountered a case where PROGRESS would simply refuse to display it on a screen for no apparent reason.

#9 Updated by Alexandru Lungu over 1 year ago

  • Status changed from Review to Internal Test

One small thing to note is that there is a weird behavior I noticed in PROGRESS with the following encodings for the OVERLAY and SUBSTRING statements:

This is out of scope.

Review of #9445:
  • I am OK with the changes.
  • Please add a history entry and change the copyright year accordingly.

#10 Updated by Constantin Asofiei about 1 year ago

Paul, what is the status on this?

#11 Updated by Paul Bodale about 1 year ago

Status of 9445a:

  • I will run all the tests I wrote again just to be sure but as long as I remember all the tests are passing.
  • Task was created out of trunk rev 15652 so it's really old and should be rebased.
  • Implementation received good feedback.
  • Only thing left to do is to add history entries

#12 Updated by Paul Bodale about 1 year ago

I ran the test again. The only tests that are failing are related to codepages marked in I18nOps with // support is undefined.

2 things to note:
  • Not all test for unsupported codepages fail.
  • All tests for supported codepges pass.

Should I touch on the failing tests, rebase and/or prepare the branch for testing customers apps?

#13 Updated by Constantin Asofiei about 1 year ago

Paul, please rebase and lets see how we can get this merged.

#14 Updated by Paul Bodale about 1 year ago

I think the branch is too old for this. Last revision is 15653. I get this error when I try to rebase it:

brz: ERROR: Key b'licensereport-20241118145747-483y9lvojp3yutw7-1' is already present in map

#15 Updated by Constantin Asofiei about 1 year ago

Paul Bodale wrote:

I think the branch is too old for this. Last revision is 15653. I get this error when I try to rebase it:
[...]

Please rebase on devsrv01.

#16 Updated by Paul Bodale about 1 year ago

Ok, I managed to rebase the branch 9445a with trunk rev. 16064

#17 Updated by Paul Bodale about 1 year ago

I also committed rev. 16066 in which I added a history entry for the change that was made.

#18 Updated by Constantin Asofiei 12 months ago

Paul, are UTF-8, ISO8859-1, IBM850 covered by the tests?

#19 Updated by Paul Bodale 12 months ago

Constantin Asofiei wrote:

Paul, are UTF-8, ISO8859-1, IBM850 covered by the tests?

Yes. Tests cover the following cases:
  • calling fix-codepage with empty lonchar
  • calling fix-codepage with unknown lonchar
  • calling fix-codepage on a longchar already fixed

#20 Updated by Constantin Asofiei 12 months ago

  • Related to Bug #9532: codepage support in ASC(), CHR(), OUTPUT TO ... CONVERT and FIX-CODEPAGE() added

#21 Updated by Constantin Asofiei 6 months ago

  • Status changed from Internal Test to Merge Pending

Please merge 9445a now.

#22 Updated by Paul Bodale 6 months ago

  • Status changed from Merge Pending to Test

Branch 9445a was merged into trunk as rev. 16342 and archived.

#23 Updated by Constantin Asofiei 6 months ago

  • Status changed from Test to Closed

Also available in: Atom PDF