Find and Replace Japanese characters in pdf file on iPhone

Hi eveybody !
I want to find and replace Japanese characters in pdf on iPhone.
I using zlib to deflate stream - endstream block and extract text.It's work fine with latin-text.
But when i work with japanese characters , I don't know how to do it ?
I decode a sample japanese pdf file, and I know that each Japanese characters are performances as hex string : "<01b7><0e230a23>..."
But i don't know how to convert Japanese characters to the hex string like that.
Can evrybody help me?
Thanks!

Searching is the same process as extracting - since it's about turning page content into something understandable.  So that still remains what you need to learn/understand - of course, referring back to all the previous sections about font formats, etc.
Replacing in PDF is EXTREMELY DIFFICULT for two reasons - subset fonts and explicit glyph positioning.  Have you determine (conceptually, if nothing else) how you plan to addresses these two issues?
PDF doesn't do UTF8 for page content - so don't worry about that.

Similar Messages

  • How do I find and replace a word in PDF?

    How do I find and replace a word in PDF?

    In the Find window (Ctrl+F) there's an option to replace the searched text.
    This is in Acrobat XI, and there's no Replace All-function.
    On Thu, Jan 15, 2015 at 4:27 PM, claireb88184899 <[email protected]>

  • Find and replace text in multiple Photoshop files?

    Hi there,
    Let us say I have six Photoshop files: 1.psd, 2.psd, ..., 6.psd. All of these files contain the word “LoremIpsum” in random text layers, within each document. Is there a way I can search for “LoremIpsum” in all documents and replace it with “Dolor Sit Amet”, all in one go? This is just an example, I need to replace various words, not just one.
    I have tried "batch find and replace" software (including powerful tools like Power Grep) but they do not work with psd files… Is there a javascript of external plugin for this kind of task?
    Thanks!

    You’re welcome, advice given here is free.
    If you want to donate something nonetheless you could do so over at
    http://ps-scripts.com/bb/
    Many of the same people used to contribute there as here and I for one have benefitted considerably from their generous advice on Scripting issues.
    A Script can read (or create) txt files, but I do not have a lot of experience with this.
    This might work (amend the line »var theTexts = readPref ("….txt", false);« according to your txt-file’s path):
    // replace text elements in type layers;
    // 2013, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
              for (var n = 0; n < app.documents.length; n++) {
                        app.activeDocument = app.documents[n];
                        app.activeDocument.suspendHistory("replace text", "main()")
    // the opertation;
    function main () {
              var myDocument = app.activeDocument;
              var theTexts = readPref ("….txt", false);
              var theArray1 = theTexts.slice(0, Math.round(theTexts.length/2));
              var theArray2 = theTexts.slice(Math.round(theTexts.length/2), theTexts.length);
              alert (theArray1.join("\n")+"\n\n\n"+theArray2.join("\n"))
              for (var b = 0; b < theArray1.length; b++) {
                        replaceText (theArray1[b], theArray2[b])
    ////// reoplace text //////
    function replaceText (replaceThis, replaceWith) {
    // =======================================================
    var idreplace = stringIDToTypeID( "replace" );
        var desc22 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref3 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idreplace = stringIDToTypeID( "replace" );
            ref3.putProperty( idPrpr, idreplace );
            var idTxLr = charIDToTypeID( "TxLr" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idAl = charIDToTypeID( "Al  " );
            ref3.putEnumerated( idTxLr, idOrdn, idAl );
        desc22.putReference( idnull, ref3 );
        var idUsng = charIDToTypeID( "Usng" );
            var desc23 = new ActionDescriptor();
            var idfind = stringIDToTypeID( "find" );
            desc23.putString( idfind, replaceThis );
            var idreplace = stringIDToTypeID( "replace" );
            desc23.putString( idreplace, replaceWith );
            var idcheckAll = stringIDToTypeID( "checkAll" );
            desc23.putBoolean( idcheckAll, true );
            var idFwd = charIDToTypeID( "Fwd " );
            desc23.putBoolean( idFwd, true );
            var idcaseSensitive = stringIDToTypeID( "caseSensitive" );
            desc23.putBoolean( idcaseSensitive, false );
            var idwholeWord = stringIDToTypeID( "wholeWord" );
            desc23.putBoolean( idwholeWord, false );
            var idignoreAccents = stringIDToTypeID( "ignoreAccents" );
            desc23.putBoolean( idignoreAccents, true );
        var idfindReplace = stringIDToTypeID( "findReplace" );
        desc22.putObject( idUsng, idfindReplace, desc23 );
    executeAction( idreplace, desc22, DialogModes.NO );
    ////// read prefs file //////
    function readPref (thePath, binary) {
      if (File(thePath).exists == true) {
        var file = File(thePath);
        file.open("r");
        if (binary == true) {file.encoding= 'BINARY'};
        var theText = file.read();
        file.close();
        return String(theText).split(",")
    In this case the comma is used to split the text into Strings in Arrays, if your search/replace texts include commas you could use something else, I guess.

  • [SOLVED] Find and replace quotes with underscores in file names

    I was looking to replace all of the quotes in file names in a directory with underscores.  I seem to be having a problem doing so, though.  Running the find command:
    find . -name '*[\`\'\"]*' -exec sh -c "mv -i '$0' '${0//[\`\'\"]/_}'" {} \;
    I get a > inviting me to continue the command.  What am I doing wrong?
    Last edited by gogi-goji (2010-01-03 02:19:13)

    @lolilolicon: yeah the -exec part does give another level of quotes, so you can run into trouble with scripts inside -exec.
    I didn't know you could give {} as an argument after sh -c and $0, that solves the problem of not knowing which quotes to use around it in the -exec part.
    $ find -mindepth 1 -exec sh -c 'mv -v --backup=t "$0" "$(echo "$0" | sed s/[\\x27\"\`]/___/g)"' {} \;
    mv: `./a b' and `./a b' are the same file
    `./\'' -> `./___'
    `./\'"\'' -> `./_________'
    mv: `./$0' and `./$0' are the same file
    mv: `./a' and `./a' are the same file
    mv: `./$(echo crash)' and `./$(echo crash)' are the same file
    `./"' -> `./___' (backup: `./___.~1~')
    `./\'\'\'' -> `./_________' (backup: `./_________.~1~')
    Or with the other substitution method, it doesn't interpret \x27 (you could use $(echo -e \\x27) or you have to use ...'\\\''...
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//['\\\''\"\`]/___}"' {} \;
    $ find -mindepth 1 -exec sh -c 'echo mv -v --backup=t "$0" "${0//[$(echo -e \\x27)\"\`]/___}"' {} \;
    mv -v --backup=t ./a b ./a b
    mv -v --backup=t ./' ./___
    mv -v --backup=t ./___ ./___
    mv -v --backup=t ./'"' ./_________
    mv -v --backup=t ./$0 ./$0
    mv -v --backup=t ./___.~1~ ./___.~1~
    mv -v --backup=t ./a ./a
    mv -v --backup=t ./$(echo crash) ./$(echo crash)
    mv -v --backup=t ./_________ ./_________
    mv -v --backup=t ./" ./___
    mv -v --backup=t ./''' ./_________
    mv -v --backup=t ./_________.~1~ ./_________.~1~

  • Pages 5: Find and replace special characters

    Has this feature gone? Or can anyone tell me where to find it? I neeed, for example, to replace double paragraph breaks with single ones, how can I do this?

    I can't find it either, but the following appears to work:
    Turn on Show Invisibles in the View menu.
    Select (highlight) the double para breaks.
    Use Command-E  (Find using selected text).
    Open the Find dialogue box (Command-F) and select Find & Replace.The selected para breaks will be in the Find text entry box, but will not be visible!
    Click in the Replace text entry box.
    Select (highlight) a single para break.
    Go to the Edit menu / Find and select 'Use selection for replace' (it will not show in the Replace entry box).
    In the Find & Replace dialogue box, click on the Forward or Back arrows to highlight the selected items (e.g. double para break) where you wish to start replacing in the document.
    Use the Replace All / Replace & Find / Replace buttons as per usual.
    Not a nice solution, but I hope it gets you going until Apple restores the previous functionality!

  • Find and replacing special characters

    we have just discovered that after database unicode conversion, some special characters are starting to appear in the database after users copy and paste into the database.
    For example from a table, we can identify it with:
    SQL> select count(*) from table where column_name like '%' || chr(25) || '%';
    COUNT(*)
    15
    This is for a table.
    How can this be done to identify the characters for all tables because we are not sure of all the tables
    Thanks

    Hi,
    Please try below pl/sql block to identify special characters in tables with respect to columns
    set serveroutput on size 1000000
    declare
    procedure gooey(v_table varchar2, v_column varchar2) is
    type t_id is table of number;
    type t_dump is table of varchar2(20000);
    type t_data is table of varchar2(20000);
    l_id t_id;
    l_data t_data;
    l_dump t_dump;
    cursor a is
    select distinct column_name
    from dba_tab_columns
    where table_name = v_table
    and data_type = 'VARCHAR2'
    and column_name not in ('CUSTOMER_KEY','ADDRESS_KEY');
    begin
    for x in a loop
    l_id := null;
    l_data := null;
    l_dump := null;
    execute immediate 'SELECT ' || v_column || ', ' || x.column_name || ', ' ||
    'dump(' || x.column_name || ')'
    || ' FROM ' || v_table
    || ' WHERE RTRIM((LTRIM(REPLACE(TRANSLATE(' || x.column_name ||
    ',''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%^&*()_+
    -=,!\`~{}./?:";''''[ ]'',''A''), ''A'', '''')))) IS NOT NULL'
    bulk collect into l_id, l_data, l_dump;
    if l_id is not null then
    for k in 1..l_id.count loop
    dbms_output.put_line(v_table || ' - ' || x.column_name || ' - ' ||
    to_char(l_id(k),'999999999999'));
    dbms_output.put_line(l_data(k));
    dbms_output.put_line(l_dump(k));
    dbms_output.put_line('*********************');
    end loop;
    end if;
    end loop;
    end gooey;
    begin
    gooey('table1','coln1');
    gooey('table1','coln2');
    gooey('table2','coln3');
    end;
    Like this you can get special characters for all the columns/particular column from table
    Thanks,
    Nitin

  • Reformatting files in Dreamweaver: Batch series of .dwr files (find and replace) consecutively

    I have to do complicated reformatting of an entire site. It's been simplified to a series of find and replace tasks for each file. Each find and replace string has been saved as a .dwr file. Currently I have to load and execute each .dwr file.
    How do you batch process or automate this task in Dreamweaver? In other words, queue up a series of .dwr files to be executed consecutively?

    OK here we go.
    This example, a simple Dreamweaver  Command Extension, will execute two Find and Replace commands in one go. (It can be any number of Find and Replace commands.)
    The first command replaces "the" and "this" with "phe" and "phis". The second command replaces <ul> ... </ul> with <ol> ... </ol>. (These of course can be any Find and Replace.)
    You need two files: a HTML file (for the  UI) and a Javascript file (for actions). I named them "Find and Replace Test.html" and "Find and Replace Test.js". (They can be any name.)
    Find and Replace Test.html
    <!DOCTYPE HTML SYSTEM "-//Adobe//DWExtension layout-engine 10.0//dialog">
    <HTML>
    <HEAD>
    <Title>Find and Replace Test</Title>
    <script src="Find and Replace Test.js"></script>
    </HEAD>
    <BODY>
    <form>
         <p>Are you sure?</p>
    </form>
    </BODY>
    </HTML>
    Find and Replace Test.js
    function canAcceptCommand() {
        return true;
    function commandButtons() {
        return new Array("Go!", "doIt()", "Cancel", "window.close()");
    function doIt() {
        dreamweaver.setUpFindReplace({
            searchString: "th(e|is)",
            replaceString: "ph$1",
            searchWhat: "document",
            searchSource: true,
            useRegularExpressions: true
        dreamweaver.replaceAll();
        dreamweaver.setUpFindReplace({
            searchString: "<(/?)ul>",
            replaceString: "<$1ol>",
            searchWhat: "document",
            searchSource: true,
            useRegularExpressions: true
        dreamweaver.replaceAll();
        window.close();
    Basically you can call any number of this pair of functions in the script:
    dreamweaver.setUpFindReplace(findAndReplaceObject);
    dreamweaver.replaceAll();
    Place these HTML and JS files in this directory:
    Dreamweaver App Directory/Configuration/Commands/ 
    Then in Dreamweaver, open "Insert" window. (You need to have a HTML file open in order to make the Insert window active.) At the top of the Insert window there's a category dropdown menu  ("Common" etc.). Do alt + click (ctrl + click) - then you'll see an item "Reload Extenesions" at the bottom of the dropdown. This will load this extension to DW. (Alternatively you can restart DW to load the extension.)
    Now it's ready to run the Extension. Open a HTML document you want to modify. Go to "Commands" on the menu bar. At the bottom of the dropdown there should be an item "Find and Replace Test". Select and enjoy
    Notes
    This example is set to perform the Find and Replace on the current document. You can change the scope to the entire site, or the selected files, etc, just like in the Find and Replace dialogue box. The API doc is here: http://help.adobe.com/en_US/dreamweaver/cs/apiref/WS5b3ccc516d4fbf351e63e3d117f9e09bcf-7ed a.html
    You can use dreamweaver.setUpComplexFindReplace(xmlQueryString) command instead. xmlQueryString is basically <dwquery> ... </dwquery> in your .dwr files, you can copy from your .dwr files. However xmlQueryString needs to be one continuous string (no line breaks), which can be a pain The doc: http://help.adobe.com/en_US/dreamweaver/cs/apiref/WS5b3ccc516d4fbf351e63e3d117f9e09bcf-7ed 9.html
    Command Extension general example in the doc: http://help.adobe.com/en_US/dreamweaver/cs/extend/WS5b3ccc516d4fbf351e63e3d117f53d6ec3-7fe 6.html
    I hope all of these make sense...
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Batch-find-and-replace.jsx

    Hi there, I wrote a batch-processing script for find change queries and thought I share it with you. You can get it over here 
    You can process GREP, TEXT, GLYPH and OBJECT searches. 
    Purpouse
    While creating books in InDesign with several documents we always come across some find change queries that need to be used again, and again, and again. To make this process easier you can just grab their names and put them into a list. The script will than try to process all your queries in one click. 
    prerequisites
    make sure you have a toml file.
    make sure the toml file is next to the script.
    make sure the toml file has the right formatting (see below in section TOML)
    if you want the script to autoexecute (without toml file selection), make sure the .toml file has the right name: "batch-find-and-replace.toml"
    make sure your fcqueries work right
    Usage
    Place the script and the toml file into your Scripts Panel Folder 
    define some find and change queries and save them via the InDesign dialogue.
    get the xml file names and add them to the "batch-find-and-replace.toml" file in the right spot. text search goes into text.files = [], grep search goes into grep.files = [] and so on. Make shure to remove the .xml from the filename. You can find these files on:
    Mac OS Users[username]\Library\Preferences\Adobe InDesign[Version][Language]\Find-Change Queries[query type] 
    Windows XP Documents and Settings[username]\Application Data\Adobe\InDesign[Version][Language]\Find-Change Queries[query type] 
    Windows Vista and Windows 7 Users[username]\AppData\Roaming\Adobe\InDesign[Version][Language]\Find-Change Queries[query type] 
    the .toml file should be located next to the script file and have the  appropriate name (batch-find-and-replace.toml). If so the script wont ask for the toml file and process the data right away. If not the script will ask you to select the .toml file.
    Thats it. Watch the magick happen.
    TOML
    Tom's Obvious, Minimal Language is a simple markup language that makes settings human readable. It is still in development and may change a lot. But still. It is a pretty easy language and can be learned by anyone.
    The basic toml filer looks like this: 
    # these are the basic settings
    # the MUST be there
    do_text = true
    do_grep = true
    do_glyph = true
    do_object = false
    # now the file names
    # they have to be in one line
    # the toml specs say you can break lines in arrays
    # but the toml.js does not allow that at the moment
    [text]
    files = ["my_first_text_find_and_change","another one"]
    [grep]
    files = ["somegrepsearch", "find tabs", "something else"]
    [glyph]
    files = []
    [objects]
    files = []
    MUST HAVE Settings
    With the do_text, do_object, do_grep and do_glyph you can define if the script should do the corresponding find and replace. Set them to true or false.
    CAN HAVE Settings
    In the [text],[grep],[glyph] and [objects] areas you can define the filenames that should be processed. Make sure the filenames are written right. If there is a file mentioned that does not exist the script will throw an error. It will try to process all the .xml files it can find.
    !IMPORTANT! you MUST remove the .xml from the filename in the list as shown above.
    The Script is here --> https://raw.github.com/...find-and-replace.jsx
    The basic .toml file here --> https://raw.github.com/...ind-and-replace.toml
    The Readme here --> https://github.com/...lob/master/README.md
    And the whole package here --> https://github.com/...e/archive/master.zip

    Great script, it worked perfectly with grep, text, glyph, not only worked with OBJECTS, because I do the same operation and does not work. Can you give me a hand? Thank you.
    In arquivo.toml is thus:
    # These are the basic settings
    # The MUST be there
    do_text = true
    do_grep = false
    do_glyph = false
    do_object = true
    do_all_docs = false
    # Now the file names
    # They have to be in one line
    # TomL the specs say you can break lines in arrays
    # But does not allow the toml.js que momento
    [text]
    files = ["_OVER_BLACK_TXT", "_OVER_CORPROF_TXT"]
    [grep]
    files = []
    [glyph]
    files = []
    [object]
    files = ["_OVER_BLACK_FILL", "_OVER_BLACK_STRK"]
    This is the image of the Scripts Panel folder:

  • Enabling tabbing to controls on DW CS 4 Mac in Find and Replace

    I have used Dreamweaver on Windows for many years. I'm now working on the Mac.
    I have configured OS X Leopard for improved keyboard access to UI controls. This allows me to tab to dropdown (or popup) menu and use the keyboard to quickly select menu items. I realize this is a personal preference but personally I'm more productive this way. This setting affects the OS and appears to work in many applications. It doesn't appear to work in Dreamweaver CS4.
    I work on one PHP project that has hundreds of files. I routinely need to use Find and Replace to search in "Selected Files in Site" but often need to only search in "Current Document", so I'm routinely switching between these options. I'm also routinely toggle the "Use regular expression" option. On Windows I could change these settings without having to use the mouse. I could quickly tab (or shift-tab) from the "Find:" and "Replace:" text boxes to the "Find In:" and "Search:"  Dropdown Menus or the various "Options:" checkboxes, but find that one the Mac I have to use the mouse to change the dropdowns and checkboxes.
    Have I missed a Dreamweaver setting or a magic keyboard shortcut that would enable full keyboard access to DW's Find and Replace and other Dialogs?

    Yep.
    "A Better Finder Rename" is great for batch file renaming.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11366
    Renamer4mac may be all you need.
    Best check out VersionTracker. In fact everybody should have this site bookmarked and visited daily.
    http://www.versiontracker.com/macosx/

  • Find and Replace Subscript

    Hi,
    I am trying to figure out how to find and replace subscripted characters, e.g. H2O (with the "2" subscripted). How is this done?

    Yeah, it has two options. Use formatting (e.g., subscript, but also font, weight, size, leading, colour and whatnot) or do not use formatting -- which does not help, as it is the same as your search string ...
    But fear not. If your "H2O" is the only one, you can do this -- what Peter meant with his two-step.
    1. Search for "H2O" and replace it with "H[ha!]O". Be sure to check both "whole word" and "case sensitive" icons below the replace field. Every "2"
    i inside
    a text "H2O" will be replaced by something unique -- that's what the "[ha!]" should be.
    2. Replace "[ha!]" with "2".
    i Uncheck
    "whole word" and "case sensitive" (because elsewise it won't find anything), and in the Replace Formatting field, select "Subscript" in the Type panel. This 2nd time, you are only replacing the unique string that was put into its unique position in the previous step.
    A 2nd option (one that I don't recommend to freshmen!) is to use the GREP Find-and-replace. This is, in the right hands, an extremely powerful tool, which can
    i search
    for "H2O" and
    i change
    just the "2" part. If I only knew how, off the top of my mind! But, it's neither an easy to remember shortcut, nor perfectly logical, and the 2-step method is.

  • Find and replace characters in file names

    I need to transfer much of my user folder (home) to a non-mac computer. My problem is that I have become too used to the generous file name allowances on the Mac. Many of my files have characters such as "*" "!" "?" and "|". I know these are problems because they are often wild cards (except the pipe). Is there a way that I can do a find and replace for these characters?
    For example, search for all files with an "*" and replace the "*" in the file name with an "@" or a letter? I don't mind having to use the terminal for this (I suspect it will be easier).
    Is this possible? Does anyone have any suggestions?
    Thank you in advance for any help you may be able to provide.
      Mac OS X (10.4.8)  

    Yep.
    "A Better Finder Rename" is great for batch file renaming.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11366
    Renamer4mac may be all you need.
    Best check out VersionTracker. In fact everybody should have this site bookmarked and visited daily.
    http://www.versiontracker.com/macosx/

  • Address book: Find and replace characters?

    Hi all,
    I just imported VCF file from Outlook to Address book. I am in Iceland and the Icelandic characters came wrong. Is there any way to batch find and replace characters in Address book? That is in individual cards.
    Thanks,
    Hilmar

    I believe the only way would be to write an AppleScript.

  • Find and replace string in file

    hi,
    i need to find and replace text (string) data in about 100+ files, i've decided to write a small java program to do it but i'm stuck on how to replace.
    here is what i'm heading towards:
    class ReplaceString {
      BufferedReader in;
      BufferedReader os;
      public static void main(String args[]) {
        ReplaceString obj = new ReplaceString();
        obj.replace();
       void replace() {
         try {
           in = new BufferedReader(new FileReader("a.txt");
           os = new BufferdWriter(new FileWriter("a.txt");
           //  read until end of file
           String currentLine = new String();
           while((currenLine=is.readLine()) != null) {
             //  if matching text then replace????
             if(currentLine.equals("Version 001") {
                // how to now replace the Version 001 with Version 002???
         }catch(IOException e) {
            System.out.println(e);
            in.close();
            os.close();
         in.close();
         os.close();
    }the above code i just typed so there might be errors, but looks ok to me, is there any way once i find the string i want to replace, to replace the string with another string. basically i want to replace all occurrences of the text "Version 001" with "Version 002"
    Thank you.

    Is it always true, as in your example, that the replacement is the same length as the existing string? If so, this one's easy.
    Is it also true that you don't need to worry about 16-bit chars? (Again, as in your example.) If you're using just ASCII characters, this gets easier still.
    1) Segregate the file I/O from the search/replace process.
    2) Main becomes:
    readFile();
    replace( "this", "that" );
    writeFile();Use a byte array buffer, defined in your main class. Fill it via the readFile() code. Use a RandomAccessFile, check its length() to allocate your byte array, then do a single read() to fill the buffer.
    A brute force search will certainly work: scan for the first search character, then check the rest for a match, replace if you've got a match and continue scanning. Alternative if your file's aren't too big: create a String from the byte array:
    // buffer is a byte array
    String s = new String( buffer );And use the String.replaceAll() to do the search/replace. Recover the buffer with:
    buffer = string.getBytes();A single write() and close() should handle the remaining work.

  • Finding and replacing (international??) characters

    I'm having trouble finding and replacing characters. Can anyone help me see the wood for the trees?
    The characters in question are single quote characters (I asume) which have been entered in a windows box/word program/filemaker progremme or some other. As such, when I open them in a flat file on my Mac I see the following:
    �A L O E�
    where the "�" and the "�" should actually be single quotes.
    On my Mac I can weed these out with the following:
    public String cleanString(String text)
         if(text != null && text.length() > 0)
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
         return text;
    }But on my server (Linux) this just isn't working. It doesn't find the characters. I've tried converting each character to unicode and looking for it that way.
    public String cleanString(String text)
         String cleaned = "";
         if(text != null && text.length() > 0)
              boolean flag = false;
              for (int i = 0; i < text.length(); i++)
                   int j = (int)text.charAt(i);
                   String u = Integer.toHexString(j);
                   if("221a".equals(u))
                        flag = true;
                        continue;
                   if(flag && "b4".equals(u) || "2260".equals(u) || "a8".equals(u) || "c6".equals(u))
                        cleaned += "'";
                        flag = false;
                   else
                        if(flag)
                             cleaned += text.charAt(i -1) + text.charAt(i);
                        else
                             cleaned += text.charAt(i);
                        flag = false;
         return cleaned;
    }But the same thing happens. It works on my mac, but not on my server.
    Part of my problem is that these 'offending characters' are actually comprised of two chars:
    eg:
    '\u221a' + '\u00b4'
    Can anyone point me in the right direction?

    As such, when I open them in a flat file on my Mac I see the following:First you should open the file using the correct character encoding. Since the file originates from a Windows box, the encoding is probably Windows-1252, aka CP1252. You'll find the code for opening and reading here, just change "UTF-8" to "CP1252."
    http://javaalmanac.com/egs/java.io/ReadFromUTF8.html
    Next, you should not write non-ASCII characters in source code because it is not portable. If the source code is moved from one system to another, like from Mac OS X to Linux, the way the compiler translates bytes to characters may change. Only ASCII is safe, so it is better to use the portable Unicode escapes (\uXXXX) to represent non-ASCII characters in strings.
    From Microsoft's own reference, the "smart" single quotes are U+2018 and U+2019: http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
    so the code to replace them would be
    text = text.replace('\u2018', '\'');
    text = text.replace('\u2019', '\'');You would need to do the same for the double quotes, \u201C and \u201D
    btw as there's a method for replacing charcters in the String class, you don't need to write a new one

  • VBA Word Find and Replace characters but excluding certain characters

    I am trying to write VBA code in Word that I will eventually run from a VBA Excel module. The aim of the project is to find specific strings in the open Word document that have length of either one or two characters and are of a certain format, and replace
    them with other strings in the same format. This is to do with transposing (i.e. changing the musical key) of chord symbols in a songsheet in Word. The Find and Replace strings are contained in ranges in an Excel workbook, which is why I want to eventually
    run the code from Excel. I'm much more experienced in writing VBA code in Excel than in Word, and I'm fairly confident with transferring the 'Word VBA' code into an Excel module.
    At the moment I'm trying out code entirely in Word, and I've come across a stumbling block. For example, I want it to Find "A" and replace with "B",
    BUT only if the "A" is NOT followed by "#" (sharp) or "b" (flat).
    Here is the code I've got in Word VBA, which I obtained by editing code produced by the recorder:
    Sub F_R()
    'Find text must have specific font
    With Selection.Find.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Replacement text must have specific font
    With Selection.Find.Replacement.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Find & Replace strings
    With Selection.Find
    .Text = "A" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Replacement.Text = "B" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = True
    .MatchWholeWord = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub
    For the Find & Replace section I want to do something like:
    With Selection.Find
    .Text = "A"
    .Text <> "A#"
    .Text <> "Ab"
    .Replacement.Text = "B"
    End With
    - but this produces a syntax error, presumably because you can have only one .Text line (or it won't accept <>?)
    I tried adopting the way of excluding chars when using the Like operator, and while it compiles, it will not replace
    any "A":
    With Selection.Find
    .Text = "A[!b#]"
    .Replacement.Text = "B"
    End With
    I suspect that I'm going to have to change tack completely in the way I'm doing this. Do you have any suggestions, please?
    The chord names/symbols are preceded/succeeded by either spaces or paragraph returns and can look like these, for example (all Font Bold and Underlined words only):
    C<sup>7</sup>
    Dm<sup>7</sup>
    Eb<sup>-5</sup>
    Bb<sup>+11</sup>
    F#m<sup>7</sup>
    i.e. [ABCDEFG][b # | optional][m |optional][- + | superscript, optional][2 3
    5 6 7 9 11 13 | superscript, optional]
    The crux of my problem is that the note A should be treated as entirely distinct from Ab or A# (and similar for other flattened/sharpened notes).
    Sorry for long post.

    Hi Ian,
    It is not easy to find Microsoft forums. However this forum is for the Visual Studio Net version. 
    Try this forum for VBA.
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    Success
    Cor

Maybe you are looking for

  • Report Generation Fails

    I having trouble with ARD 3.1 generating reports. I select a remote computer to run a report on and then it queues. The report than hangs in the process of generating. In activity monitor ARD shoots up to 145% use of CPU when the report tries to gene

  • HP Pavilion HDX9000 Connect to External DVD Player

    Our older HP Pavilion HDX9000 DVD died and we wanted to use an external DVD player to drive the monitor on the HDX9000.   It does not seem possible to do this despite the HDMI and many other ports.  The PC is running Vista.   Any suggestions?

  • Regarding an error in Dynamic action for hiring

    Hi Experts, when i perform a hiring action"AA" for action type "02" or "01" using a dynamic action .it is throwiing an error. " perform not found" "CX_SY_DYN_CALL_ILLEGAL_FORM" "MP000000" OR " MPPERS00" "MEASURE" please let me know how to proceed . r

  • HTML5 plays in IE but not Chrome

    This is the first time I've had this problem, but it might be just my PC whatever. http://hissign.com/newdevelopment/deaf-community.html Video on above page plays fine in IE but surprisingly not Chrome as I've never had this issue in Chrome before. C

  • Websites can't detect my browser. How can I correct this? (ff 7.0.1)

    A couple days ago I noticed that websites aren't able to determine which browser (or version) I'm using. For example, I went to Google's WhatBrowser.com, to see how it recognized my browser. The result? "You are using: Sorry, we couldn't recognize yo