Help with Unicode query please

Hi there,

I’ve written a find and replace script for Quark.
The script works fine however I’m trying to make it a little more intelligent.

To cut a long story short I’m trying to insert a non-breaking space into a line of text.
The unicode value is:-

00A0 - hex
160 - dec

I’ve read quite a number of posts regarding unicode text however I’ve not found my answer,
well atleast I think I haven’t.
How can I insert a unicode character using it’s hex or dec value?

I’ve tried inserting an ASCII character 160 but no luck???

Thanks in advance,


Hi Nick,

you can use this:

set a to «data utxt00A0» as Unicode text

Hi Stefan,

Thanks for the help with the query.
I’d found posts along the same lines but they were to do with inserting text.

Thanks again,


You might also want to check out Using Unicode-only characters in script strings, Nick. It includes several methods of producing Unicode characters ” along with a script to convert pasted Unicode text to raw Unicode data.

I am trying something similar with QXP 6.5. I have one character that is being entered incorrectly by some outside vendors. Future files will be received correctly, but previous files need to be cleansed. The input and output Unicode characters are below. I just started this, so its a bit rough. Is this the direction I need to be moving in? Some of these files may have a hundred or so pages of text and graphics, so speed is of the essence.

This script will address a specific instance and replacement. How realistic would a script that had variable inputs and outputs?


--This script will change the
--characters to

copy text item delimiters of AppleScript to savedDelim
set text item delimiters of AppleScript to {":"}
set text item delimiters of AppleScript to savedDelim

set charInput to «data utxt00BA»
set charOutput to «data utxt00B0»

display dialog "Input - Masculine Ordinal Indicator: " & charInput & return & "Output - Degree Sign: " & charOutput

set sourceFolder to choose folder with prompt "Choose the folder to process"
tell application "Finder" to set theFiles to files of folder sourceFolder whose kind contains "QuarkXPress"
repeat with oneFile in theFiles
	tell application "QuarkXPress"
		open (oneFile as alias)
		tell front document
			repeat with p from 1 to count of pages
				repeat with a from 1 to count of text boxes
					repeat with c from 1 to count of characters
						if c is charInput then
							set c to charOutput
						end if
					end repeat
				end repeat
			end repeat
		end tell
	end tell
	--close saving yes
end repeat

--display dialog "Character change done."

Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox
Operating System: Mac OS X (10.4)