Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language verify question #3632

Closed
yesszus opened this issue Jan 19, 2019 · 12 comments
Closed

Language verify question #3632

yesszus opened this issue Jan 19, 2019 · 12 comments
Assignees
Labels
status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing.

Comments

@yesszus
Copy link
Contributor

yesszus commented Jan 19, 2019

Verify my language pack in localhost (windows 10 and xampp).
This is bug?

All errors: Non UTF-8 Characters Found

lan

php

@tgtje
Copy link
Contributor

tgtje commented Jan 20, 2019

No, it are no bugs. While changing (upload or transport) likely some white spaces were added just in front of starting php line eg. .... <php (points are blank) OR after closing tag.
In this case you ALSO may edit the file directly (use edit button), check IFF ..and save > that would work also. (however try to be sure if the lang pack (github) does not have it, because edit mode is system..)

@yesszus
Copy link
Contributor Author

yesszus commented Jan 21, 2019

Perfect for the language pack and only for windows under this error.
Not find <php (points are blank) OR after closing tag.

@tgtje
Copy link
Contributor

tgtje commented Jan 21, 2019

I suppose it is the Hungarian latest lang pack you are referring to.
Just downloaded it, installed and did run a check.
I too get 81 mistakes. Using the edit mode i do see that NOT all defines eg translations are read/displayed... Very strange....

@Moc can you please have a look into the Hungarian lang pack too ?

example

@Moc
Copy link
Member

Moc commented Jan 22, 2019

Two issues:

  1. Issue reported by @tgtje that not all defines are read/displayed

  2. The non-UTF8 error is caused by the ő and ó. Looking into it.

EDIT: I might be wrong about my conclusion on issue 2. Looking into it...

@Moc
Copy link
Member

Moc commented Jan 22, 2019

@CaMer0n Can you take a look at this please?

Test code:

<?php

function is_utf8($str) {
	/*
	* @see http://hsivonen.iki.fi/php-utf8/   validation.php
	*/
	if(strtolower('CHARSET') != "utf-8" || $str == "")
	{
		return TRUE;
	}

	return (preg_match('/^.{1}/us',$str,$ar) == 1);
}


$strings = array(
		"Főadminisztrátor",
		"Hői", 
		"Rendszerinformáció", 
		"Felhasználó", 
		"Regisztrált felhasználó"); 


echo "Test 1: mb_check_encoding() <br />"; 
foreach($strings as $string)
{
	if(mb_check_encoding($string, "UTF-8") == false)
	{
		echo "Error: ".$string." is NOT UTF-8 <br />"; 
	}
	else
	{
		echo "Success: ".$string." is UTF-8 <br />"; 
	}
}

echo "<br /><br />";
echo "Test 2: is_utf8() - e107 method <br />"; 

foreach($strings as $string)
{
	if(!is_utf8($string))
	{
		echo "Error: ".$string." is NOT UTF-8 <br />"; 
	}
	else
	{
		echo "Success: ".$string." is UTF-8 <br />"; 
	}
}

All test $strings pass as UTF-8 but but in e107_admin\lancheck.php on line 1310 $this->is_utf8($check[$k][$sk]) returns false.....
No idea where the issue is....

@Moc Moc added the status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing. label Jan 22, 2019
@Moc
Copy link
Member

Moc commented Jan 23, 2019

@SimSync Maybe you have an idea on this one?

@SimSync
Copy link
Contributor

SimSync commented Jan 23, 2019

@CaMer0n @Moc On line 1926 (lancheck.php), the string from the language file get's malformed for some reason.
I think it's because of the regex used to extract the define values.

Edit: I think i found the issue... There was a missing unicode flag in the regex to match the defines.
Will check it first with the current hungarian and russian language files.

Edit: It is working for me. PR submitted

SimSync added a commit to SimSync/e107 that referenced this issue Jan 23, 2019
missed the "u" (unicode) flag. Due to that, some utf-8 values
were malformed during processing.
@yesszus
Copy link
Contributor Author

yesszus commented Jan 23, 2019

Solved problem!
Great job @SimSync !

@yesszus yesszus closed this as completed Jan 23, 2019
@tgtje
Copy link
Contributor

tgtje commented Jan 23, 2019

Just to confirm it does work here too 👍 (all (81) errors are gone.. (Hungarian)

CaMer0n added a commit that referenced this issue Jan 23, 2019
Fixes #3632: Lancheck failed on some utf-8 values
@CaMer0n
Copy link
Member

CaMer0n commented Jan 26, 2019

Thank you @SimSync @Moc
We should add that test code into e107-tests

@SimSync
Copy link
Contributor

SimSync commented Jan 30, 2019

@CaMer0n Could you provide the test class for lancheck.php? I will add than the tests

@CaMer0n
Copy link
Member

CaMer0n commented Jan 30, 2019

@SimSync Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: testing required Someone needs to confirm this issue's existence and write a test to prevent the fix from regressing.
Projects
None yet
Development

No branches or pull requests

5 participants