Input to unicode in mysql and angular

spaceman

Let's say i have an input where i ask the user to put just the letter of a card. Let's say "KdKc". Beside of showing the user a KDKC/kdkc/KdKc i would like to show the unicode for the suits. K⋄K♣

Anyone knows how do i do this conversion?

I am inserting it into table like this:

$hand = json_decode(file_get_contents("php://input"),true);
        $hand_names = array('handNumber', 'hand');
        $keys = array_keys($hand);
        $columns = '';
        $values = '';
        foreach($column_names as $desired_key){ // Check the hand received. If blank insert blank into the array.
           if(!in_array($desired_key, $keys)) {
                $$desired_key = '';
            }else{
                $$desired_key = $hand[$desired_key];
            }
            $columns = $columns.$desired_key.',';
            $values = $values."'".$$desired_key."',";
        }
        $query = "INSERT INTO hands_table(".trim($columns,',').") VALUES(".trim($values,',').")";
        if(!empty($hand)){
            $r = $this->mysqli->query($query) or die($this->mysqli->error.__LINE__);
            $success = array('status' => "Success", "msg" => "Hand Created Successfully.", "data" => $hand);
            $this->response($this->json($success),200);
        }else
            $this->response('',204);    //"No Content" status

and showing through a ng-repeat

 <tr ng-repeat="data in customers">
            <td>{{data.hand}}</td>
            <td><a href="#/edit-hand/{{data.handNumber}}" class="btn">&nbsp;<i class="glyphicon glyphicon-edit"></i>&nbsp; Edit Hand</a></td>
        </tr>

I appreciate the time!

kevin

How about creating a filter? Working plunker

app.filter('cardSymbol', function() {
  return function(input) {
    if (!input) {
      return input;
    }
    input = input.replace(/s/g, '\u2660');
    input = input.replace(/h/g, '\u2665');
    input = input.replace(/d/g, '\u2666');
    input = input.replace(/c/g, '\u2663');
    return input;
  }
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

input() and literal unicode parsing

From Dev

Input unicode string with pyautogui

From Dev

Convert user input to unicode

From Dev

input() and literal unicode parsing

From Dev

unicode support java and mysql

From Dev

Using Term::ReadLine with Unicode input

From Dev

Adjusting Unicode based on user input

From Dev

comparing the unicode character from user input to unicode characters in file

From Dev

solving the comparison of unicode input string in the file with unicode data

From Dev

Angular translate unicode issue in Firefox

From Dev

Unicode characters encoding for a MySQL output

From Dev

c# mysql AddWithValue unicode

From Dev

Unicode Characters issue in Cakephp and Mysql

From Dev

c# mysql AddWithValue unicode

From Dev

How to input Unicode character in Rails console?

From Dev

Unicode input Windows 8.1 Store App

From Dev

Emberjs Input TextField value Unicode convert

From Dev

Input Unicode characters in Pluto.jl

From Dev

Is it possible to unbind or change the unicode input global shortcut?

From Dev

Is it possible to unbind or change the unicode input global shortcut?

From Dev

How to input Unicode character in Rails console?

From Dev

How to print Unicode glyph names for input string?

From Dev

Unicode input Windows 8.1 Store App

From Dev

Python: raw_input should be converted to unicode

From Dev

angular2 template binding unicode

From Dev

How to display unicode from Typescript into Html with Angular

From Dev

Difference between ANSI and Unicode drivers of MySQL

From Dev

MySQL string contains only certain unicode characters

From Dev

mysql select not working with unicode characters a ä, d ḏ, ŋ

Related Related

HotTag

Archive