Sponsored Content
Top Forums Shell Programming and Scripting Help with \u0401 codes ? unicode or something Post 302461203 by tip78 on Saturday 9th of October 2010 05:51:08 AM
Old 10-09-2010
well those codes looks similar to what i need but anyway i need to get them from casual characters through perl
perl somehow can convert it but i can't find how Smilie

---------- Post updated at 12:27 PM ---------- Previous update was at 10:40 AM ----------

found such function on javascript with whole charmap:

Code:
function koi2unicode(str) {
   var charmap   = unescape(
"\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590"+
"\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\u00A0\u2321\u00B0\u00B2\u00B7\u00F7"+
"\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556\u2557\u2558\u2559\u255A\u255B\u255C\u255D\u255E"+
"\u255F\u2560\u2561\u0401\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569\u256A\u256B\u256C\u00A9"+
"\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E"+
"\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A"+
"\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E"+
"\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A")
var code2char = function(code) {
               if(code >= 0x80 && code <= 0xFF) return charmap.charAt(code - 0x80)
               return String.fromCharCode(code)
            }
   var res = ""
   for(var i = 0; i < str.length; i++) res = res + code2char(str.charCodeAt(i))
   return res
}

but i still need it on perl :\

---------- Post updated at 01:51 PM ---------- Previous update was at 12:27 PM ----------

EXAMPLE
unpack("U",u046F) gives 117
117 is the code of character "u" (chr(117) = u, ord(u) = 117)

so HOW to get u046F back from 117 ???

pack("U",117) gives "u" but not hes code
hex(117) gives 279..

Last edited by tip78; 10-09-2010 at 06:57 AM.. Reason: Code tags, please...
tip78
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

unicode

Hi, I have some software I need to install on HP-UX 11iv1 64bit but it must not be set up in unicode mode. I know unicode/ ASCII etc. I don't know how to get unix to switch between these. Is there an environment setting for that? I use the Korn shell. Thanks. (2 Replies)
Discussion started by: rein
2 Replies

2. Programming

How to display unicode characters / unicode string

I have a stream of characters like "\u8BBE\u5907\u7BA1" and i want to display it. I tried following things already without any luck. 1) printf("%s",L("\u8BBE\u5907\u7BA1")); 2) printf("%lc",0x8BBE); 3) setlocale followed by fwide followed by wprintf 4) also changed the local manually... (3 Replies)
Discussion started by: jackdorso
3 Replies

3. UNIX for Advanced & Expert Users

Unix and Unicode

All, I'm trying to grasp how to use Unicode with/in Unix. I've made progress on some fronts, for example, when uploading files to my server I can use the intermediary language to convert the file to UTF-8. I'm having trouble getting Samba to do this (I'm using "unix charset" in smb.conf);... (4 Replies)
Discussion started by: effigy
4 Replies

4. Programming

Concerned about C and UNICODE

Dear experts, While developping a C UNICODE application under AIX 5.3, I encountered the following problem, and after days of investigations I still could not find any solution. Please note that the application is full wchar_t based (not utf8) and that I could compile and run it without any... (4 Replies)
Discussion started by: tgilbert
4 Replies

5. Programming

unicode problem

on some distributions UTF-32 is the default and i need to change the size of wchar_t to 2 bytes. i tried to compile it with -fwide-exec-charset=UTF-16 but it didn't help. anyone have any ideas? thanks, Akos (3 Replies)
Discussion started by: Akimaki
3 Replies

6. Programming

Unicode programing in C

im starting to go a little serious with c, woking in a personal project that will read a xml, which might contain Unicode characters (i know it will on my system, which is set to es_AR.UTF-8) im using mxml, and the documentation says it uses utf8 internally (no worries here). so i need to be... (4 Replies)
Discussion started by: broli
4 Replies

7. UNIX for Advanced & Expert Users

mail with Unicode support

Hello, I have a question. There is a command line mail client "mail", it is good, but obviously, does not support Unicode. Are there any (other) mail clients for command line having support for Unicode (UTF-8) and maybe other encodings? Or are there any other versions of mail/mailx programm which... (0 Replies)
Discussion started by: Action
0 Replies

8. Programming

Unicode filenames in C++?

I'm trying to figure out how to support Unicode or atleast an unsigned char in the d_name of struct dirent The problem i'm facing is that I'm checking file names for special characters and obviously the "char d_name" doesn't like it. I'm looping through the directory and getting the file... (3 Replies)
Discussion started by: james2432
3 Replies

9. Shell Programming and Scripting

Unicode file validation

I don't want HTML_CONTENT,RICH_CONTENT,TEXT_CONTENT columns data in the file and reset of data we need to extract. Find the attached file. Need to extract date in between DI_UX_ROW_END tag. Can help me using unix command using AWK. Thanks, (2 Replies)
Discussion started by: bmk
2 Replies

10. Shell Programming and Scripting

Unicode help

is there any way to handle unicode such as ʃʰɐm̆ (1 Reply)
Discussion started by: sreejithalokkan
1 Replies
JavaScript::Beautifier(3pm)				User Contributed Perl Documentation			       JavaScript::Beautifier(3pm)

NAME
JavaScript::Beautifier - Beautify Javascript (beautifier for javascript) SYNOPSIS
use JavaScript::Beautifier qw/js_beautify/; my $pretty_js = js_beautify( $js_source_code, { indent_size => 4, indent_character => ' ', } ); DESCRIPTION
This module is mostly a Perl-rewrite of <http://github.com/einars/js-beautify/tree/master/beautify.js> You can check it through <http://jsbeautifier.org/> FUNCTIONS
js_beautify( $js_source_code, $opts ); beautify javascript. options indent_size indent_character if you prefer Tab than Space, try: { indent_size => 1, indent_character => " ", } preserve_newlines default is 1 my $in = "var a=dont_preserve_newlines"; my $out = "var a = dont_preserve_newlines"; my $js = js_beautify( $in, { preserve_newlines => 0 } ); # $out eq $js $in = "var a=do_preserve_newlines"; $out = "var a = do_preserve_newlines"; $js = js_beautify( $in, { preserve_newlines => 1 } ); # $out eq $js space_after_anon_function default is 0 AUTHOR
Fayland Lam, "<fayland at gmail.com>" COPYRIGHT &; LICENSE Copyright 2008 Fayland Lam, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2009-12-30 JavaScript::Beautifier(3pm)
All times are GMT -4. The time now is 09:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy