Problems with string encoding - need the text content in char* format.

The problem is non ASCII-characters, which comes out as some sort of unicode I need to desipher.
Here's what I got:
A text frame object with the TextString "Agnartjørna"
I get the text content of this object into an ai::UnicodeString the following way:
AIErr
VMGetTextOfTextArt( AIArtHandle textArt, ai::UnicodeString &ucStr)
    ASUnicode *textBuffer = NULL;
    AITRY {
        TextFrameRef ateTextRef;
        AIX( sAITextFrame->GetATETextFrame( textArt, &ateTextRef));
        ATE::ITextFrame ateText( ateTextRef);
        ATE::ITextRange ateRange = ateText.GetTextRange( true);
        ASInt32 textLen = ateRange.GetSize();
        AIX( sSPBlocks->AllocateBlock( (textLen+2) * sizeof( ASUnicode), nil, (void**) &textBuffer));
        ateRange.GetContents( textBuffer, (ASInt32) textLen+1);
        /* trim off trailing newlines */
        if ((textBuffer[textLen] == '\n') || (textBuffer[textLen] == '\r'))
             textBuffer[textLen] = 0;
        ucStr.clear();
        ucStr.append( ai::UnicodeString( textBuffer, textLen));
        sSPBlocks->FreeBlock( textBuffer);
        textBuffer = NULL;
       AIRETURN;
    AICATCH {
        if (textBuffer) sSPBlocks->FreeBlock( textBuffer);
       AIPROPAGATE;
Now, the next step is to convert it into a form that I can use to call regexp.
Baiscally, I want to detect the ending "tjørna" (meaning small lake) on a map label, and apply a standard abbevriation "tj^a" (with "a" superscripted).
So the problem is to obtain the regexp pattern and the text content in same encoding.  And since the regexp library is old *char based, I would like to convert the text content in to plain old *char.
Hence the following code:
static AIErr
VMAbbreviateTextArt( AIArtHandle textArt,
                         vmTextAbbrevEffectParams *params)
    AITRY {
    /* first obtain the text contents of the textArt */
       ai::UnicodeString ucText;
      const int kTextLen = 256;
      char textContent[kTextLen];
      AIX( VMGetTextOfTextArt( textArt, ucText));
      ucText.as_Roman( textContent, kTextLen);
But textContent now has the value "Agnartj\xbfnna"  (According to XCode),
which will not get a match on the pattern "tj([øe][rn])na\\" (with  backslash matching the end of the string)
Any other ways to convert the textContent to a plain *char string?

Thank you very much, your method will work fine. with
the "UTF-8" parameter the byte[].length is double,
cause every valid byte is preceeded by an -62, but I
will just filter the valid bytes into a new array.
Thanks again,
StefanActually what you need to do is to find the character encoding that your device expects, and then you can code your strings in Arabic.
That's the way Java does things; Strings and char values are always in UNICODE (see www.unicode.org) (which means \u600 to \u6ff for arabic) and uses a specified character encoding when translating these to and from a byte stream.
Each national character encoding has a name. Most of them are identical to ASCII for 0-127 and code their national characters in 128-255.
Find the encoding name for your display and, odds are, the JRE has it in the library.
BTW the character encoding ISO-8859-1 simply maps UNICODE characters 0-255 on to bytes.

Similar Messages

  • Probleme with string encoding

       Hello,
    I have an application in Flex3 and when I send an Soap Query, I have a corect enveloppe,
    but when I try the same code in Flex 4, the sting is encoding :
    exemple :
    Flex 3 :
      <ns1:orderLine>
          <ns1:line_nr>2</ns1:line_nr>
          <ns1:productCode>7443</ns1:productCode>
          <ns1:quantity>20</ns1:quantity>
         </ns1:orderLine>
    Flex 4 :
      <ns1:orderLine>
          <ns1:line_nr>1</ns1:line_nr>
          <ns1:productCode>&lt;productCode xmlns=&quot;http://emt.netsoa.netinfluence.com/types/order">7505</productCode></ns1:productCode>
          <ns1:quantity>20</ns1:quantity>
         </ns1:orderLine>
    The integer is correct, but the string fail.
    How can i correct this ?
    Jean

    Your flex 4 response is translated as below after replacing reserved xml characters.  -
      <ns1:orderLine>
          <ns1:line_nr>1</ns1:line_nr>
          <ns1:productCode><productCode xmlns="http://emt.netsoa.netinfluence.com/types/order">7505</productCode></ns1:productCode>
          <ns1:quantity>20</ns1:quantity>
         </ns1:orderLine>
    its strange that a productCode element came under the productCode element itself. Can you check if this was possibly due to the server returning a malformed response. help in this link -
    http://anirudhs.chaosnet.org/blog/2009.06.01.html
    I can analyze this if you provide the soap packet dumps

  • Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Numbers does not have rotated text within cells.  You can place a text box over the cell that has rotated text but you cannot rotate text within a cell.

  • I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, howev

    I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, however the arrows will move it OK.  Also I cannot drag the selection to another photo in the photo bin as before.

    Hi,
    Please refer: http://helpx.adobe.com/photoshop-elements/kb/pse-stops-responding-yosemite.html
    Thanks,
    Anwesha

  • HT1338 We are currently running CS3 on Macs with OS 10.5.8 but need to upgrade the OS in order to prepare e-books. Will we have any problems with CS3 running on the later OS?

    We are currently running CS3 on Macs with OS 10.5.8 but need to upgrade the OS in order to prepare e-books. Will we have any problems with CS3 running on the later OS?

    Check the Adobe website for compatibility.
    Ciao.

  • I've just downloaded facetime and every tie I attempt to open it I get the message"there was a problem with facetime you need to quit and reopen facetime" I've tried this but  I just get the same message again and again

    i've just downloaded facetime and every tie I attempt to open it I get the message"there was a problem with facetime you need to quit and reopen facetime" I've tried this but  I just get the same message again and again

    Hello tadom,
    Thanks for the question. The following article outlines the exact error message you described, and a potential resolution:
    OS X: "An internal FaceTime error occurred" alert after clicking Facetime icon in the Dock
    http://support.apple.com/kb/TS4457
    Thanks,
    Matt M

  • Mail problem with long titles using utl_smtp / mixed content / attachements

    Hello,
    I'm having a problem with sending emails. The title as well as the body needs to be able to contain accented letters (é ç ...).
    For the body i got it working.
    And the title works fine too, untill the encoding passes a certain length, then goes all wrong and my mail header starts showing up in the mail body.
    Could anyone help me in finding a solution?
    Thanks in advance
    Below my code:
    DECLARE
       v_From       VARCHAR2(80) := 'test@localhost';
       v_Recipient  VARCHAR2(80) := 'test@localhost';
       v_Cc         VARCHAR2(80);
    -- long subject causing problems
       v_Subject    VARCHAR2(32000) := '123456789111111111111111111111118888888888888111111111111111991234567891111111111111111111111188888888888881111111111111119912345678911111111111111111111111888888888888811111111111111199';
       v_body       VARCHAR2(32000) := '<a href="#">tester</a><br><br>en nog wat éékes en ççkes';
       v_Mail_Host  VARCHAR2(30) := 'localhost';
       v_Mail_Conn  utl_smtp.Connection;
       crlf         VARCHAR2(2)  := chr(13)||chr(10);
    BEGIN
      v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
      utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
      utl_smtp.Mail(v_Mail_Conn, v_From);
      utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
      utl_smtp.Data(v_Mail_Conn,
    -- write header
        'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
        'From: '   || v_From || crlf ||
        'Subject: ' || utl_encode.MIMEHEADER_ENCODE(v_Subject) || crlf ||
        'To: '     || v_Recipient || crlf ||
        'Cc: '     ||  v_Cc || crlf ||
        'X-Mailer: Mailer by Oracle UTL_SMTP' || crlf ||
        'X-Priority: 1' || crlf ||
        'MIME-Version: 1.0'|| crlf ||       -- Use MIME mail standard
        'Content-Type: multipart/mixed;'|| crlf ||
        ' boundary="-----SECBOUND"'|| crlf ||
        crlf ||
    -- add message body
        '-------SECBOUND'|| crlf ||
        'Content-type: text/html; charset=UTF-8'|| crlf ||
        'Content-Transfer-Encoding: base64'|| crlf ||
        crlf ||
        utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(v_body)))||
        crlf ||
    -- add csv attachment
        '-------SECBOUND'|| crlf ||
        'Content-Type: text/plain;'|| crlf ||
        ' name="excel.csv"'|| crlf ||
        'Content-Transfer_Encoding: 8bit'|| crlf ||
        'Content-Disposition: attachment;'|| crlf ||
        ' filename="excel.csv"'|| crlf ||
        crlf ||
        'CSV,file,attachement'|| crlf ||   -- Content of attachment
        crlf ||
        '-------SECBOUND--'                            -- End MIME mail
      utl_smtp.Quit(v_mail_conn);
    EXCEPTION
      WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
        raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    Hi,
    I did not think the characterset and database would matter for this problem, but here is the info you requested.
    The database is an Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    The characterset : NLS_CHARACTERSET     AL32UTF8
    And i don't have a clue about the characterset of the operating system (not even sure what the operating system is), but i think that will be utf-8 aswell.
    I'm not sure what i did, to come over as rude, but i didn't mean to and i apologize for it.

  • Chart - problem with realize one of the function under CR XI

    Post Author: mrowa
    CA Forum: Charts and Graphs
    Hello,
    I have
    problem with realize one of the function under CR XI. I would be persuade if
    any of us would like to help me.
    1)   
    1) From
    database (basically from one table), I take data to make report. Each of record
    have appropriate fields:
    dteData
    intYear
    intMonth
    intDate
    2)   
    2) I
    want to realized comparison data from two or more periods of time on one chart
    and in one table. For easily explanation I will describe problem on two
    periods.For instance, user want to display and compare
    on chart date (type monthly -sum data of each month) from 2007.02 u2013 2007.05
    with date from 2006.03 u2013 2006.06. So we compare month 2007.02 with 2006.03;
    2007.03 with 2006.04; 2007.04 with 2006.05; 2007.05 with 2006.06
    On char I would like to display bars with comparison
    of months.
    Problem is that I donu2019t know how to write
    something similar. I can use one period without any problems, but two and mores
    I canu2019t realized.
    Detail description:
    I passed
    two parameters two report:
    {?from}, {?to} u2013for first period
    {?offset}, it means {?from}+{?offset},
    {?to}+{?offset}  - for second period
    On axis Y I have Sum(intDate);On
    X (year + month). But on each value x( example 20007.02) I need to have
    two values (bars). Value for standard period and offset.
    For example for x=2007.02, I need
    two bars one equal 2007.02 and second with offset u2013 2006.03
    Movement to next value (bar) is
    persuade by fields {data.rok}&{data.month} first or second period. This is
    combination of two elements year&month defined under Formula. Problem
    persist in that both period has different year.month and here problem starts once
    again. I donu2019t know how to solve it. I have found out one solution but it
    limits user only for two periods (I want to compare more).
    My idea for compare only two
    periods:
    I make one query in CR for one
    period and second query for second period.
    Firs query:
    "SELECT 
           year ,
          month
    Second query
    "SELECT 
           year + FLOOR({month + offset} % 13),
          {month + offset} % 13
    Then in CR I connect two periods and
    make u201Ctableu201D (results of queries) with JOIN on fields year and month.
    This solution is not functional,
    because I need to make reports for days and hours as well. In this solution I
    canu2019t use (%31), because not all months has 31 days.
    I use CR in WEB app made in Visual
    Studio 2005. Maybe from aspx we can manipulate with date to get exact solution,
    and solve problem with SELECT.
    Hope my description clearly
    describe problem and someone will be able to help me. I would be thankful.

    I have had similar problem before.
    Because I had too many data, the legend would not display all the data. Also the chart would not display all the data. But I was able to find a work around.
    In your case, Right click on the Legend text and click on Format Legend Entry.
    Change the font of the legend to 4 (which is the minimum). This may work.
    If you are also having problem with data labels, you could change the font size of the data labels.
    Hope this helps.
    Thank you.

  • How to get the text content of an XMLElement

    Hi,
    Here is a XML sample:
    <toto attrib1="titi">tata</toto>
    We want to get the text content "tata".
    Using an XMLElement (from the class "oracle.xml.parser.v2.XMLElement) to manipulate the element "toto", when we use the getNodeValue method, we always retrieve "null".
    So, what is wrong in our procedure and how to resolve this problem?
    Thanks in advance for your help
    Bye

    You need to get the child nodes of the Element and iterate until you find a node of type Node.TEXT_NODE.
    Elements don't have text content, they instead contain text node children.
    Just remember, too, that they can also contain comments, processing instructions, etc., in addition to the text you are looking for:
    <toto><!-- a comment --><?pi?>Tata</toto>

  • Little problem with Strings.

              I have an little problem with Strings, i make one comparision like this.
              String nombre="Javier";
              if( nombre.equalsIgnoreCase(output.getStringValue("CN_NOMBRESf",null)) )
              Wich output.getStringValue("CN_NOMBRESf",null) is "Javier" too, because I display
              this before and are equals.
              What I do wrong?.
              

    You are actually making your users key in things like
    "\026"? Not very user-friendly, I would say. But
    assuming that is the best way for you to get your
    input, or if it's just you doing the input, the way to
    change that 4-character string into the single
    character that Java represents by '\026', you would
    use a bit of code like this:char encoded =
    (char)Integer.parseInt(substring(inputString, 1),
    16);
    DrClap has the right idea, except '\026' is octal, not hex. So change the radix from 16 to 8. Unicode is usually represented like '\u002A'. So it looks like you want:String s = "\\077";
    System.out.println((char)Integer.parseInt(s.substring(1), 8));Now all you have to do is parse through the String and replace them, which I think shouldn't be too hard for you now :)

  • HT1222 I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be..

    I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be...
    I never updated anything until now...I want o update my iPhone to the newest version, but i do not want ot loose all that I have on this phone. I was told I needed to update the operating systems so i can put things into the cloud for transport to new phone, but I am just not sure how to do this..Can you help out here??

    Dear Jody..jone5
    Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
    Goodluck
    Atousa

  • Hi how to edit the text content in CSV

    Hi,
    I need to edit the text content in CSV using java script.
    The content goes like this..........
    "missing image No"
    need to replace "No" by "Yes"
    Thanks in advance

    > I need to edit the text content in CSV using java script.
    Something like this work. I haven't tested it but it pretty close :)
    var file = new File("~/somefile.csv");
    file.open("r");
    file.close();
    var str = file.read();
    var nstr = str.replace(/\bNo\b/g, 'Yes');
    file.open("w");
    file.write(nstr);
    file.close();
    -X

  • When I make a project in iDVD'09, there are sometimes green blocs with points flickering in some scenes of my iMovie-film. In iMovie there is no problem with this film, but the problem begins by exporting to iDVD and making a project there.

    When I make a project in iDVD'09, there are sometimes - at voluntary moments - green blocs with points flickering in some scenes of my iMovie-film.
    In i-Movie there is no problem with  this film, but the problem begins by exporting to iDVD and making there a project.
    Who can help me, then I cann't find everything about this in any forum?

    Hi
    Can be a problem that get multiplied and visible when iDVD encode for DVD.
    A. See if problem can be isolated to a single frame in the movie and re-import this clip and see if it's better
    B. When free space on Start-Up hard disk goes low - strange things like this might occure. I never go under 25Gb free space on this Start-Up Mac OS hard disk !
    C. Does this problem arises what ever encoding quality You use ?
    Yours Bengt W

  • Problem with String variable

    I am new to Java Programming.
    I have a line of code that works and does what is supposed to.
    faceData.getProfile("Lisa").removeFriend("Curtis");
    If I assign the strings to variables such as-
    String name = "Lisa";
    String fName = "Curtis";
    and then plug those into the same line of code, it does not work
    faceData.getProfile(name).removeFriend(fName);
    What could be causing the problem?
    I even added some lines to print out what is stored in the variables to verify that they are what they should be, but for some reason the variables do not work while putting the strings in quotes does. Any ideas?

    I guarantee that something about your assertions are incorrect. Those variables are either not equal to the values you claim, or something else is going on. But it's not a problem with string variables versus string constants.
    Edit: My best guess in lack of a real example from you, is that the strings in question have non-printable characters in them, such as trailing spaces or line feeds.

  • Hello i have a problem with my airport express the music sizzles? Why?

    Hello i have a problem with my airport express the music sizzles? Why?
    What can i do?

    Does the game has the same iOS requirements that your phone has? Games needing iOS7 will not install on iOS6 and earlier.
    Did you try to download it to your computer and sync it to your phone after that?
    If you can't connect to the iTunes Store, try these suggestions:
    Can't connect to the iTunes Store

Maybe you are looking for

  • Portal Hide property in Portal 7.4

    Hi experts, I need to hide the Wd-java iView/page at runtime and should not be visible to portal front-users.  As it includes some logic to change the language of the user from any language to English_UK. But in Portal 7.4 SP6, I am not able to see a

  • In search of Unity 5 ES89

    Does anyone know if ES89 is available, just not public? Trying to setup Digital Networking or Unity to Unity Connection Interchange and understand that for Unity 5 you need ES89. http://www.cisco.com/en/US/partner/docs/voice_ip_comm/unity/compatibili

  • Act As Not working in 11 1 60

    Hi, I'm getting below error message in 'sawlog6.log' file after selecting PROXY user in the drop down list and am seeing Home Page Screen. [2012-11-19T11:14:29.000-05:00] [OBIPS] [ERROR:1] [] [saw.securitysubsystem.checkauthentication] [ecid: e445e65

  • Multiple selection ranges reversed when I append on storyline

    When I append multiple selection ranges in a clip to the storyline, the order is reversed on the storyline.  I've found others with similar issues and no solution aside from deleting FCP preferences in the library and/or reinstalling, both of which i

  • After dn/load 5, Google mail scroll dn arrow hidden behind alter page size triangular icon making scroll inoperative

    I am running Windows 7. I downloaded the update to Firefox (now 5) with the result that the scroll arrow in the bottom right hand corner is now sharing that space with the small triangular icon that alters the size of the viewed page. Scrolling down