Skip to content
Snippets Groups Projects

Issue #1630568: Validate that uploaded .po files are UTF8

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 1377 1378 }
    1378 1379 return $form_element;
    1379 1380 }
    1381
    1382 function locale_validate_file_encoding(FileInterface $file, $encoding) {
  • 1377 1378 }
    1378 1379 return $form_element;
    1379 1380 }
    1381
    1382 function locale_validate_file_encoding(FileInterface $file, $encoding) {
    1383 $error = [];
    1384 if (!mb_check_encoding(file_get_contents($file->getFilename()), $encoding)) {
    1385 $error[] = sprintf("Your file is not %s encoded", $encoding);
  • added 1 commit

    • 127a130c - #1630568 Rename function to file_validate_encoding() and move it to the file module.

    Compare with previous version

  • Ravi Shankar added 1 commit

    added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • quietone changed the description

    changed the description

  • quietone changed target branch from 9.4.x to 11.x

    changed target branch from 9.4.x to 11.x

  • quietone added 4685 commits

    added 4685 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • eb1e7e0e - Use plugin for file encoding validation

    Compare with previous version

  • added 1 commit

    • 0a42b7bb - Include test for invalid encoding

    Compare with previous version

  • 8
    9 /**
    10 * Defines an encoding constraint for files.
    11 */
    12 #[Constraint(
    13 id: 'FileEncoding',
    14 label: new TranslatableMarkup('Checks if a file is encoded with a specific encoding.', [], ['context' => 'Validation'])
    15 )]
    16 class FileEncodingConstraint extends SymfonyConstraint {
    17
    18 /**
    19 * The error message.
    20 *
    21 * @var string
    22 */
    23 public $message = "The file is not encoded with %encoding";
  • 15 )]
    16 class FileEncodingConstraint extends SymfonyConstraint {
    17
    18 /**
    19 * The error message.
    20 *
    21 * @var string
    22 */
    23 public $message = "The file is not encoded with %encoding";
    24
    25 /**
    26 * The missing extension message.
    27 *
    28 * @var string
    29 */
    30 public $extensionMessage = "The extension 'mbstring' is not installed";
  • added 1 commit

    • 56329b0f - Apply 3 suggestion(s) to 2 file(s)

    Compare with previous version

  • Kalle Vuorjoki added 2 commits

    added 2 commits

    • a8f3a951 - Dont require mbstring on composer
    • 80e96707 - Remove checking for native mbstring extension

    Compare with previous version

  • Kalle Vuorjoki added 9 commits

    added 9 commits

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading