PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 1, 2022

[FIXED] How to make my phpmyadmin (yii2 code) understand foreign languages?

 February 01, 2022     phpmyadmin, yii2, yii2-advanced-app     No comments   

Issue

<?= $form->field($model, 'description')->textarea(['rows'=>20,'columns'=>100,'maxlength' => 4000]) ?>


<div class="form-group">
    <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Add') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>

this is my view. if i run the code and try to insert a value in the form field 'description' in my local language like this (വിനീത്) the value that gets stored is " ????? ". how can i store the value as (വിനീത്) itself and display it in the view.

as said by @Akhil Thayyil i tried like this in my view

<div class="synopsis-form col-md-5">
    <h2><?= Html::encode($this->title) ?></h2>



    <?php $form = ActiveForm::begin( [
                'method' => 'post',
                'id'     => 'add-fanclub',
                'accept-charset'=>'UTF-8'
                ] );?>

    <?= $form->field($model, 'description')->textarea(['rows'=>10,'maxlength' => 1000]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>

but i got a error like this Setting unknown property: yii\widgets\ActiveForm::accept-charset

my main-local.php in common/config (yii2 advanced app)is as follows

'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=user_urshow',
            'username' => 'user',
            'password' => 'user',
            'charset' => 'utf8',
        ],

Solution

I got it working. i went to phpmyadmin selected the table and set the property 'collation' to utf8_general_ci and now i can insert ജിലെബി and it will get stored in database as ജിലെബി and i can view in my website as ജിലെബി itself. courtsey



Answered By - Bloodhound
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing