开发者

Assign Unused Unicode Character in Ubuntu

开发者 https://www.devze.com 2023-03-25 09:33 出处:网络
开发者_运维技巧I have a piece of old code that is trying to assign two unicode characters to one unused Unicode character (sorry, I am not using the right terms, but hopefully it gets the issue across

开发者_运维技巧I have a piece of old code that is trying to assign two unicode characters to one unused Unicode character (sorry, I am not using the right terms, but hopefully it gets the issue across). So U17ff is mapped to "ាំ" etc.

Here's the bash script:

for folder in /usr/X11R6/lib/X11/locale/*UTF-8
do
  file="$folder/Compose"
  if [ -f "$file" ]   # is there a compose file?
  then
    if grep -q "<U17ff>" "$file"   # is there Khmer in the file already
    then
      echo "Warning: $file includes Khmer already!"
    else
      cp --backup=t --force -v "$file" "$file"   # create a backup file
      cat Compose >>"$file"                      # append Khmer
      echo "$file Khmer added"
    fi
  fi 
done

The Compose file is this:

# Khmer digraphs

<U17ff> :   "ាំ"
<U17fe> :   "ោះ"
<U17fd> :   "េះ"
<U17fc> :   "ុំ"
<U17fb> :   "ុះ"

I think the directory isn't right for this code, so the keyboard it is trying to install doesn't work because the unicode character it calls is still blank (I've used the default Khmer keyboard that comes with Ubuntu, and it doesn't work properly, so I am trying to fix it).

Can anyone tell me the directory I should use rather than /usr/X11R6/lib/X11/locale/*UTF-8 For Ubuntu 11.x?

Thanks, Nathan


Turns out this was a bigger issue than I thought (it is a bug), but there is a way around it:

  1. Type sudo gedit /etc/environment
  2. Add a line GTK_IM_MODULE=xim
  3. Save and close.

4.Then in terminal type: sudo gedit /usr/share/X11/locale/en_US.UTF-8/Compose

  1. Gedit should open, search for Khmer and make sure the following exists (if not, copy and paste it in):
#
# Khmer digraphs
#
<U17ff> : "ាំ"
<U17fe> : "ោះ"
<U17fd> : "េះ"
<U17fc> : "ុំ"
<U17fb> : "ុះ"
  1. Save and reboot.

And everything works fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消