Hey there!
I'm from Costa Rica. The law pertaining knives here is really primitive, and if you have a run in with the authorities (meaning police), it's all in the end up to the officer's decision. Most probable thing is that not even the officer will know about the law; I've had multiple times when they've had to call back the station to ask a police lawyer if the weapon I was carrying was legal (gladly, those times it has been legal)
LEGALLY SPEAKING, the law (Ley 7530 de Armas y Explosivos) says that a knife is only a weapon when it is not meant for other things, such as work or kitchen, etc. So if you're carrying say a big ass machete, if you can prove to the officer (most likely the judge will be the officer, not an actual judge, since bureaucracy here is a PITA) that you're using it for work, then you'll get away with it. If youre carrying a machete say in a trail, noone's gonna ask anything, and you're kinda proving you're using it for the trail. In the same sense, if say, you're a butcher and you're carrying a butcher knife for whatever reason in the city, and you can prove that it's meant for WORK, then it'll be "legal". The law here is very subjective on that. If you cannot prove that your blade is for work or for utilitarian purposes besides self-defense, then it's considered a weapon.
The thing about weapons is, that the law states that you cannot carry "a weapon" in a populated area (what the law probably means by populated area is a city, and not the countryside, but it's not clear on that) at all. It all gets very muddy from here on. Maybe you might just get a warning from the police if you're carrying a self-defense blade in the city, but again, it's all up to the officer. Now the law states that no bladed weapon (folding or fixed, or otherwise) can exceed 9 cms (about 3 and a half inches I think). Another problem with the law is that it doesn't specify whether the 9 cms means the whole knife, or just the blade of it. If it is over 9 cms, then it's considered a "prohibited weapon". Technically, carrying a "prohibited weapon" will land you 5 to 9 years in prison, but that probably won't happen. Inside the law's definition of a prohibited weapon, a blade is not even considered, but is only referred to when it reaches the part about carrying blades in public. That is, the law defines prohibited weapons and includes stuff such as bombs, mustard gas, rifles, etc, but doesn't mention blades. Blades are defined as "prohibited weapons" later in the law.
Anyways, I've never been in a situation where I've been unlucky as to get caught with a "prohibited weapon". I have been searched by police at times when I've been carrying telescopic batons, pepper spray and small utility folders (like a SAK or case knives) but never with a knife whose blade is longer than the 9 cms. I have friends who have though, and what usually happens is that they just get confiscated, but nothing worse happens (like going to prison). I've also seen police officers give the knife back, even when it was over the law's regulations, but that's because police here don't know the law, don't have time to go through the paperwork (I doubt if they have the capability, since most of them are recruited from marginal areas, with little education, which is sad imo) and even if they did, the lawyers, judges and everyone else in the case wouldn't wanna bother with it either (most legal cases here last about 8 years, its that bad).
If you look like a tourist, I really doubt you will get searched. If you're evidently out hiking, just explain to the officer that you're using your knife for hiking purposes. If you carry a machete in the middle of the city, you'll stand out, but in rural areas, it's common to see people on the street, going to or from work, with a machete hanging from their belt. It's also "legal", given the hazyness of the law. I've had to explain to policemen that I use my knife for utility purposes, and I think that, so long as you don't look like you're out mugging people, or running from someone, you'll be fine. I also think it's best that if you're out drinking, don't carry a knife. First, most bars have bouncers that check for weapons, and second, it's also semi-legal to carry a knife if you're drinking.
So yeah, bring your knives here! It'll keep you safer, you probably won't have any run-ins with the police, and if they get grumpy, just act like a tourist and tell them you didn't know it was illegal. They'll most often than not give it back. That's just how it works here.