Morse Code Translater
Note: When translating Morse to Text: For best results, each grouping of morse symbols that translates to a letter should be separated with a space, and each word with two spaces. One space will be eliminated between each morse character, so this will yield natural looking english.
For example, SOS SINKING should be entered as:
... --- ...(two spaces here) ... .. -. -.- .. -. --.
For English to Morse: A space will be inserted between characters unless there is already something between them; if there is only a space, two spaces will be inserted to preserve word separations.
Other Hints
The characters period ., bullet •, middle-dot ·, and asterisk * will be interpreted as dits; an ellipsis … will be treated as three dits.
_, the hyphen -, and the en-dash – will be treated as dahs. If an em-dash — manages to find its way in, it will be treated as two consecutive dahs on the assumption that it was inserted by AutoCorrect. Apologies for the unprompted lesson on dashes!
If you are on a Mac, your browser might auto-translate three consecutive periods into an Elipsis character. Right click in the text box, and from Substitutions, un-check Text Replacement.
The forward slash / can be translated to Morse, so please don't use that as a word separater.
If you lump a bunch of dots and dashes together you'll probably get nothing like what you expected. But short of some complicated string alignment program exploring all possible boundaries to see which give translations that are in the dictionary, that's the best that can be done. Because of how regular expressions work, the longest matching morse character will be pulled off the front of any space-deliniated section that is not itself an entire morse character.
Morse Table Used
Perhaps the main oddity is that there is no distinct translation for brackets, thus [ and ( generate the same morse code.
- A .-
- B -...
- C -.-.
- D -..
- E .
- F ..-.
- G --.
- H ....
- I ..
- J .---
- K -.-
- L .-..
- M --
- N -.
- O ---
- P .--.
- Q --.-
- R .-.
- S ...
- T -
- U ..-
- V ...-
- W .--
- X -..-
- Y -.--
- Z --..
- 0 -----
- 1 .----
- 2 ..---
- 3 ...--
- 4 ....-
- 5 .....
- 6 -....
- 7 --...
- 8 ---..
- 9 ----.
- . .-.-.-
- , --..--
- ' .----.
- ? ..--..
- : ---...
- - -....-
- / -..-.
- [ -.--.
- ( -.--.
- ] -.--.-
- ) -.--.-
- " .-..-.
- _ ..--.-
- = -...-
- + .-.-.
- @ .--.-.
- Ä .-.-
- Å .--.-
- É ..-..
- Ñ --.--
- Ö ---.
- Ü ..--