Sponsored Content
Operating Systems Linux Red Hat ICU resource bundling on Linux: error faced while using Key more than 15 chars Post 302320496 by prashant_jindal on Thursday 28th of May 2009 07:02:47 AM
Old 05-28-2009
ICU resource bundling on Linux: error faced while using Key more than 15 chars

Hi,

I am trying to use ICU resource bundle on Unix and created a resource bundle "root.res" from the following file.

root {
abcdefghijklmnop { "16 character key" }
abcdefghijklmno { "15 character key" }
abcdefghijklmn { "14 character key" }
abcdefghijklm12 { "13 C 2 Int" }
abcdefghijklm123 { "13 Char 3 Int" }
abcdefghij123456 { "10 char 6 int" }
ab1234567891012 { "1234567891012" }
abcdefghijklmnopqrstuvwxyz { "Char 26" }
}

When I use C++ program to fetch these data from the resource file, it throws the below error if key is more than 15 characters
(for example abcdefghijklmnop or abcdefghij123456).

[root@localhost ICU_POC]# ./StringExtern root

Enter the key : abcdefghij123456

Thing using cout = 10 char 6 int ----> output displayed before error.
*** glibc detected *** corrupted double-linked list: 0x087c51b8 ***
Aborted

Please note it was able to display the value but then threw the error.

If key is less than equal to 15 characters (for example abcdefghijklmno ) , values are fetched properly without errors.

[root@localhost ICU_POC]# ./StringExtern root

Enter the key : abcdefghijklmno

Thing using cout = 15 character key

This problem is seen only on Linux and not on windows. We are able to use keys (more than 16 characters) on Windows without any error.

Does anybody have an idea about this problem? Is this the limitation for Linux or something is wrong in execution?


C++ program:

Code:
#include <iostream>
#include "unicode/msgfmt.h"
#include "unicode/resbund.h"
#include "unicode/unistr.h"
#include "unicode/ulocdata.h"
#include "unicode/ustream.h"
#include <wchar.h>

int main(int argc, char* argv[])
{
   UErrorCode status = U_ZERO_ERROR;

   if ( argc !=2 )
   {
      cout << "Please run the executable in the following format:" << endl;
      cout << "StringExtern <locale code>" << endl;
      cout << "For reference of locale code see http://www.loc.gov/standards/iso639-2/" << endl;
      return 0;
   }

   //Setting the default locale passed by the user
   Locale::setDefault(argv[1],status);

   //Initializing  the constructor of the ResourceBundle class which takes two parameters.  //path of the .dat file, status)

   ResourceBundle resourceBundle("/root/Desktop/ICU_POC/myapp",status);
   
   //Check for the error in reading the .dat file(resource bundle)
   if(U_FAILURE(status)) 
   {
      printf("Can't open resource bundle. Error is %s\n", u_errorName(status));
      return 0;
   }

   //Extracting the text corresponding to the text passed to the getStringEx function.

   char *pj=new char();
   cout<<"\nEnter the key : ";
   cin>>pj;

   UnicodeString thing = resourceBundle.getStringEx(pj, status);

   // Check for the error in extractring the text (may not be a valid text)

   if(U_FAILURE(status))
   {
      printf("Can't find String. Error is %s\n", u_errorName(status));
      return 0;
   }

  cout<<"\nThing using cout = "<<thing<<endl;
   return 0;
}


Any input or help is appreciated in this regard.

Thanks,
Prashant Jindal
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

2. Linux

ICU Java

Collegues Rendering of my language in Java is not proper. I have created a patch for ICU. How can I integrate the patch to Jdk1.5.0_09 or Jre. Which .so file I have to replace for it . With warm regards jaganadh.G (0 Replies)
Discussion started by: jaganadh
0 Replies

3. UNIX for Advanced & Expert Users

restrict the user not to key in more than 50 chars

am looking like something... eg: Input:testing and the cursor should stop after a particular length and not allow user to enter any more chars in shell scripting not awk (1 Reply)
Discussion started by: injeti
1 Replies

4. Shell Programming and Scripting

restrict the user not to key in more than 50 chars

When my script is run, it will ask the user to enter some text and the user should be restricted not to enter more than 50 chars. Is there any command which I can use with "read" command? Help me please (18 Replies)
Discussion started by: injeti
18 Replies

5. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

6. Shell Programming and Scripting

Issue faced while accessing data from files on different servers.

I have two log files of same name and structure which resides on different servers with ssh-keygen installed. I want to search for a list of strings available in an array on last 15 minutes logs of both files and calculate the total count of occurence of each string. Sample format of both file... (0 Replies)
Discussion started by: poweroflinux
0 Replies

7. Red Hat

HELP - Resource/Performance Monitoring Script - Red Hat Enterprise Linux Server

Hi all, ------------------------- Linux OS Version/Release: ------------------------- Red Hat Enterprise Linux Server release 5.5 (Tikanga) Linux <hostname> 2.6.18-194.8.1.el5 #1 SMP Wed Jun 23 10:52:51 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux I have a server that hosts 30+ Oracle... (1 Reply)
Discussion started by: newbie_01
1 Replies

8. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

9. Red Hat

Linux PaceMaker Equivalent to a SharedAddress Resource Type

In HA platforms, there is the concept of a "Scalable Resource Type, which included the sharedaddress" that is used in commonly Web Servers resource groups. The sharedaddress resource type is provided so a developer can use this Resource type to build their own scalable resource group. I see... (1 Reply)
Discussion started by: mrmurdock
1 Replies
keyboard_ucallback(3alleg4)                                       Allegro manual                                       keyboard_ucallback(3alleg4)

NAME
keyboard_ucallback - User specified unicode keyboard callback handler. Allegro game programming library. SYNOPSIS
#include <allegro.h> extern int (*keyboard_ucallback)(int key, int *scancode); DESCRIPTION
Unicode-aware version of keyboard_callback(). If set, this function is called by the keyboard handler in response to every keypress. It is passed the character value and scancode that are about to be added into the input buffer, can modify the scancode value, and returns a new or modified key code. If it both sets the scancode to zero and returns zero, the keypress will be ignored. This routine executes in an interrupt context, so it must be in locked memory. Example: int silence_g_key(int key, int *scancode) { if (key == 'g') { *scancode = 0; return 0; } return key; } END_OF_FUNCTION(silence_g_key) ... install_timer(); LOCK_FUNCTION(silence_g_key); install_keyboard(); keyboard_ucallback = silence_g_key; Note that this keyboard callback has priority over the non unicode callback. If you set both, only the unicode one will work. SEE ALSO
install_keyboard(3alleg4), readkey(3alleg4), ureadkey(3alleg4), keyboard_callback(3alleg4), keyboard_lowlevel_callback(3alleg4) Allegro version 4.4.2 keyboard_ucallback(3alleg4)
All times are GMT -4. The time now is 12:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy