Skip to content

Develop multi ling 03 10 2019 no mb4 pg#402

Closed
mgage wants to merge 19 commits into
openwebwork:developfrom
mgage:develop_multi_ling_03_10_2019_no_mb4_pg
Closed

Develop multi ling 03 10 2019 no mb4 pg#402
mgage wants to merge 19 commits into
openwebwork:developfrom
mgage:develop_multi_ling_03_10_2019_no_mb4_pg

Conversation

@mgage
Copy link
Copy Markdown
Member

@mgage mgage commented Mar 12, 2019

tweak encode(UTF-8) and :utf8 layers for input/output. This version should work with legacy courses and versions of mysql older than 5.3 which cannot handle utf8mb4. This replaces PR #390

goehle and others added 19 commits June 20, 2016 20:57
create records in PG->{flags} with settings which will influence the
HTML lang and dir attributes set for the HTML element containing the
problem. This allows proper detection of the language of the problem in
the browser, when it is not the primary course language, and to override
the direction for cases when a LTR problem is being viewed/assigned in a
course in a RTL course, or visa-versa. The flag values set in the problem
are processed in the subroutine output_problem_lang_and_dir() in
	webwork2/lib/WeBWorK/ContentGenerator/Problem.pm
if there is no override set in the course configuration.
set flags for the problem language and textdirection which can be accessed
inside the webwork2 code to allow using this data to set the HTML lang and
dir tags as needed on DIV elements which envelop the problem text.
…ction_to_PG_flags

Add lang and direction to pg flags
@taniwallach
Copy link
Copy Markdown
Member

I have not yet had a chance to test the code in this new PR for multi lingual support.

However:

  1. It is not clear to me how the pg code as compared to what was in New develop candidate multilingual #390 has any direct relation to the SQL level difference between utf8mb4 and utf8.
    • The mySQL utf8 charset is a subset of the full UTF8 which includes only characters which need at most 3 bytes in the UTF-8 encoding, and excludes those which use the fourth bytes. As PG does not interact directly with the database - it should not have any direct relation to this issue.
    • Maybe this is just an error in the explanation given in the commit message for ead35d7
  2. The changed files relative to New develop candidate multilingual #390 seem to only be VERSION (minor change) and lib/PGloadfiles.pm (but some of PR 390 was changed by a very recent commit 3d94218 discussed more below, and a merge commit from develop of unrelated changes).
    • Maybe the problem was just that open(MACROFILE, "encoding(UTF-8)", $filePath) || die "Cannot open file: $filePath"; should have had <:encoding(UTF-8) and only had encoding(UTF-8) ???
    • However, if this subroutine is being run in WWSafe - then the revised code should work around the problems getting the Encode module to work inside WWSafe.
    • Note: New develop candidate multilingual #390 had a different line open(MACROFILE, "<:utf8", $filePath) || die "Cannot open file: $filePath"; until commit 3d94218 tried to change it (and that older version of PR 390 has been working well for me).

@mgage
Copy link
Copy Markdown
Member Author

mgage commented Mar 12, 2019

Perhaps the lack of the colon is why encode(UTF-8) didn't work, but I don't think so. I think it was a conflict with Safe. I was wondering if the PGloadmacros.pl was run before Safe was locked down -- but it appeared this was not the case.

What is there now should be approximately equivalent to <:utf8 but allows for some additional intervention if that turns out to be helpful. utf8::upgrade() for example seems to try to upgrade latin1 text to utf8. I'm not sure how reliable it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants