镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

RG2 is missing foeign characters from beginning of competitor names. #287

Open

Description

@andzs

Checking out RG2 I run in following issue - RG2 is missing first character of competitor name if it starts with foreign character. Integrated Splitsbrowser displays names correctly without any problems.
All the data files are in UTF8 encoding. The problems with UTF8 and fgetcsv are described also here
http://stackoverflow.com/questions/5756373/missing-first-character-of-fields-in-csv
https://bugs.php.net/bug.php?id=48507#1274173422

Quick and dirty fix for me was using setlocale(LC_ALL, 'en_US.UTF-8'); at begginning of rg2api.php but that should be used only in case of UTF-8 for data and RG2 encoding.

Activity

  1. Maprunner commented on Jul 13, 2015

    @Maprunner
    Owner

    This doesn't happen on my test set-up or any of the installed sites I know about. Can you please provide a few more details:

    1. What version of PHP are you using?

    2. Is this a new RG2 installation or is it using an old RG1 database?

    3. What are RG_INPUT_ENCODING and RG_OUTPUT_ENCODING set to in your rg2-config.php file?

    4. Can you give me a link so that I can see the problem?

  2. andzs commented on Jul 13, 2015

    @andzs
    Author

    Hello,

    1. I have hosted environment

    phpinfo() data available here http://mezu.lv/info.php

    1. I have old RG1 database which was converted to UTF-8 and worked for a
      while with RG1 Javascript version

    2. Config

      bash-4.1$ cat rg2-config.php | grep -E "^\s+define"

      define('RG_BASE_DIRECTORY', 'http://izskreju.mezu.lv/gadget');

      define('SPLITSBROWSER_DIRECTORY', 'http://izskreju.mezu.lv/splitsbrowser'
      );

      define('RG_FILE_ENCODING', 'UTF-8');

      define('UI_THEME', 'smoothness');

      define('HEADER_COLOUR', '#002bd9');

      define('HEADER_TEXT_COLOUR', '#ffffff');

      define('ADDITIONAL_INFO_TEXT', '');
      4.

    OK setup with setlocale (and define('RG_BASE_DIRECTORY', '
    http://izskreju.mezu.lv');) http://izskreju.mezu.lv/rg2/#125
    http://izskreju.mezu.lv/rg2/#125

    Problematic setup without setlocale http://izskreju.mezu.lv/gadget/rg2/#125
    http://izskreju.mezu.lv/gadget/rg2/#125

    Take a look, please, at course M21S

    In results sixth position correct name is "Ēriks Lebedoks" but problematic
    version returns "riks Lebedoks".
    On 15th position "Ģirts Pakalns" turns into "irts Pakalns" and his
    submitted GPS entry got corrupted name permanently (the same in both
    setups).
    Just look for names starting with non capital letters to find other
    examples.

    Splitbrowser in problematic setup
    http://izskreju.mezu.lv/gadget/rg2/rg2api.php?type=splitsbrowser&id=125 for
    the same course will show that names are OK.
    In this case rg2api is not using fgetcsv to get results, names and
    everything looks fine.

    --Andris

    On Mon, Jul 13, 2015 at 10:29 PM, Simon Errington notifications@github.com
    wrote:

    This doesn't happen on my test set-up or any of the installed sites I know
    about. Can you please provide a few more details:

    1. What version of PHP are you using?

    2. Is this a new RG2 installation or is it using an old RG1 database?

    3. What are RG_INPUT_ENCODING and RG_OUTPUT_ENCODING set to in your
      rg2-config.php file?

    4. Can you give me a link so that I can see the problem?

    —
    Reply to this email directly or view it on GitHub
    #287 (comment).

    Andris Strazdiņš
    tel. 29248436

  3. andzs commented on Jul 14, 2015

    @andzs
    Author

    Hi,

    I expanded possible solutions for my problem and I think that problem goes
    away if Apache has

    SetEnv LC_ALL en_US.UTF-8

    directive in .htaccess file (I am unable to modify httpd.conf file in
    hosted environment). Locale setting is set to UTF-8 in apache and derived
    environment and there is no need to use setlocale in php code anymore.

    --Andris

    On Tue, Jul 14, 2015 at 2:41 AM, Andris Strazdiņš andzss@gmail.com wrote:

    Hello,

    1. I have hosted environment

    phpinfo() data available here http://mezu.lv/info.php

    1. I have old RG1 database which was converted to UTF-8 and worked for a
      while with RG1 Javascript version

    2. Config

      bash-4.1$ cat rg2-config.php | grep -E "^\s+define"

      define('RG_BASE_DIRECTORY', 'http://izskreju.mezu.lv/gadget');

      define('SPLITSBROWSER_DIRECTORY', '
      http://izskreju.mezu.lv/splitsbrowser');

      define('RG_FILE_ENCODING', 'UTF-8');

      define('UI_THEME', 'smoothness');

      define('HEADER_COLOUR', '#002bd9');

      define('HEADER_TEXT_COLOUR', '#ffffff');

      define('ADDITIONAL_INFO_TEXT', '');
      4.

    OK setup with setlocale (and define('RG_BASE_DIRECTORY', '
    http://izskreju.mezu.lv');) http://izskreju.mezu.lv/rg2/#125
    http://izskreju.mezu.lv/rg2/#125

    Problematic setup without setlocale http://izskreju.mezu.lv/gadget/rg2/#125
    http://izskreju.mezu.lv/gadget/rg2/#125

    Take a look, please, at course M21S

    In results sixth position correct name is "Ēriks Lebedoks" but
    problematic version returns "riks Lebedoks".
    On 15th position "Ģirts Pakalns" turns into "irts Pakalns" and his
    submitted GPS entry got corrupted name permanently (the same in both
    setups).
    Just look for names starting with non capital letters to find other
    examples.

    Splitbrowser in problematic setup
    http://izskreju.mezu.lv/gadget/rg2/rg2api.php?type=splitsbrowser&id=125
    for the same course will show that names are OK.
    In this case rg2api is not using fgetcsv to get results, names and
    everything looks fine.

    --Andris

    On Mon, Jul 13, 2015 at 10:29 PM, Simon Errington <
    notifications@github.com> wrote:

    This doesn't happen on my test set-up or any of the installed sites I
    know about. Can you please provide a few more details:

    1. What version of PHP are you using?

    2. Is this a new RG2 installation or is it using an old RG1 database?

    3. What are RG_INPUT_ENCODING and RG_OUTPUT_ENCODING set to in your
      rg2-config.php file?

    4. Can you give me a link so that I can see the problem?

    —
    Reply to this email directly or view it on GitHub
    #287 (comment).

    Andris Strazdiņš
    tel. 29248436

    Andris Strazdiņš
    tel. 29248436

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions