I am currently programming an addon that I will release to the community once it is ready.
It is a Text-To-Speech chat program which can translate between languages.
I believe that would be useful for servers with international playerbases.
All of that aside, I am having an issue with URLs being parsed incorrectly.
I was previously having an issue with special characters such as accentuated letters (i.e. é) being turned into '�'s
To attempt to fix this, I used a URL encoder function to change special characters into their ASCII encoded counterparts to remedy this.
[CODE]
function url_encode(str)
if (str) then
str = str:gsub("\n", "\r\n")
str = str:gsub("([^%w %-%_%.%~])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = str:gsub(" ", "+")
end
return str
end
[/CODE]
The URL is then returned correctly, but for some reason, I think it is converted back to the special characters which turn into '�'s and ruin the text-to-speech synthesis.
However, if I paste the URL into chrome, the text-to-speech is synthesised correctly.
I realise that this is quite a confusing problem to understand and it was hard to put into words, which is why I made a video of it.
[video=youtube;DCaV2Qgibjg]http://www.youtube.com/watch?v=DCaV2Qgibjg[/video]
Help would be greatly appreciated!
Thanks.
Added video for clarity
Bump - Still no replies, really need help
Alright, I found out exactly what the problem is.
Gmod seems to parse:
[url]http://translate.google.co.uk/translate_tts?tl=fr&q=%C3%A9[/url]
as:
[url]http://translate.google.co.uk/translate_tts?tl=fr&q=%C3+%A9[/url]
OR
[url]http://translate.google.co.uk/translate_tts?tl=fr&q=%E9[/url]
as:
[url]http://translate.google.co.uk/translate_tts?tl=fr&q=%C3%A9[/url]
as:
[url]http://translate.google.co.uk/translate_tts?tl=fr&q=%C3+%A9[/url]
Putting the + in completely messes up the tts
I don't know how to fix this however
I found out that it's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url] that doesn't work as it should.
Using an empty DHTML vgui with OpenURL to play the sound instead.
[QUOTE=r0uge;47473625]I found out that it's [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url] that doesn't work as it should.
Using an empty DHTML vgui with OpenURL to play the sound instead.[/QUOTE]
How did you try to use sound.PlayURL()? Also what's the format of the text-to-speech return?
Sorry, you need to Log In to post a reply to this thread.